how to set up rotating proxy service with node.js?

zfc

Junior Member
Joined
Jul 23, 2022
Messages
187
Reaction score
73
Hello,
I'm trying to create a rotating proxy service with node.js (any other software will do) but I couldn't succeed.
What are the software used to create a rotating proxy? I'm trying to create a rotating proxy that returns the list of proxies I provide every time it connects, but I failed.
 
Hello,
I'm trying to create a rotating proxy service with node.js (any other software will do) but I couldn't succeed.
What are the software used to create a rotating proxy? I'm trying to create a rotating proxy that returns the list of proxies I provide every time it connects, but I failed.
I tried to understand what do you need, but it's a little confusing, do you wanna rotate proxies for yourself "Change ip for every request" or for your clients "as proxies provider"?
 
  • Like
Reactions: zfc
I tried to understand what do you need, but it's a little confusing, do you wanna rotate proxies for yourself "Change ip for every request" or for your clients "as proxies provider"?

Sorry, my English is poor.
I want to be a proxy provider. I have a list of http proxies.
host:port:username:password
I have proxies in the format Every time the purchaser connects to my server to use a proxy, I need to redirect requests to a proxy of my choice.
I will provide information like below. Every time the user uses a proxy with this information, they will use it over the ip I have assigned.

1699052029899.png
 
Sorry, my English is poor.
I want to be a proxy provider. I have a list of http proxies.
host:port:username:password
I have proxies in the format Every time the purchaser connects to my server to use a proxy, I need to redirect requests to a proxy of my choice.
I will provide information like below. Every time the user uses a proxy with this information, they will use it over the ip I have assigned.
I got it now, unfortunately, it's a little complicated without coding skills

First you need to setup a server that listen to incoming connections from your users, as I understand you already done that.
For the authentication you may consider it too, to allow only authorized users.
so for the rotation part you asked for, you need your server to act as intermediary, u can use library like http-proxy and express-http-proxy

here's a simple code that may give you idea on how to implement this
const express = require('express');
const httpProxy = require('http-proxy');

const app = express();
const proxy = httpProxy.createProxyServer();

// Map users to assigned proxies
const userProxyMap = new Map();

// Endpoint to assign a proxy to a user
app.post('/assign-proxy/:userId/:proxyUrl', (req, res) => {
const { userId, proxyUrl } = req.params;
userProxyMap.set(userId, proxyUrl);
res.send('Proxy assigned successfully');
});

// Proxy requests
app.use('/proxy/:userId/*', (req, res) => {
const userId = req.params.userId;
const proxyUrl = userProxyMap.get(userId);

if (proxyUrl) {
proxy.web(req, res, { target: proxyUrl });
} else {
res.status(403).send('User has no assigned proxy');
}
});

const port = 3000;
app.listen(port, () => {
console.log(`Proxy server is running on port ${port}`);
});

Users can be assigned a proxy by making a POST request to /assign-proxy/:userId/:proxyUrl. Users can then make requests through the assigned proxy by accessing /proxy/:userId/...
 
  • Like
Reactions: zfc
I got it now, unfortunately, it's a little complicated without coding skills

First you need to setup a server that listen to incoming connections from your users, as I understand you already done that.
For the authentication you may consider it too, to allow only authorized users.
so for the rotation part you asked for, you need your server to act as intermediary, u can use library like http-proxy and express-http-proxy

here's a simple code that may give you idea on how to implement this


Users can be assigned a proxy by making a POST request to /assign-proxy/:userId/:proxyUrl. Users can then make requests through the assigned proxy by accessing /proxy/:userId/...

Thank you very much for your reply. I have tried these but I get a connection error.

" cause: Error: Proxy connection ended before receiving CONNECT response"
https://www.croxyproxy.com/I think proxy.web works when you want to install a service like the one above.
I tried to set up the server as you mentioned and print the requests to the console, but there is no incoming request. No matter what I did, I couldn't get it to work :(


1699053343507.png
1699053360593.png
 
Thank you very much for your reply. I have tried these but I get a connection error.

" cause: Error: Proxy connection ended before receiving CONNECT response"
https://www.croxyproxy.com/I think proxy.web works when you want to install a service like the one above.
I tried to set up the server as you mentioned and print the requests to the console, but there is no incoming request. No matter what I did, I couldn't get it to work :(
You need to solve that yourself unfortunately, cuz there's many factors why you aren't catching requests.
Code issue x Firewall x network routing x permissions....

did you test locally? works fine?
 
  • Like
Reactions: zfc
You need to solve that yourself unfortunately, cuz there's many factors why you aren't catching requests.
Code issue x Firewall x network routing x permissions....

did you test locally? works fine?
I only tested it locally :(
I will test it on a server today in case it is a url problem. Thank you very much
 
Hello,
I'm trying to create a rotating proxy service with node.js (any other software will do) but I couldn't succeed.
What are the software used to create a rotating proxy? I'm trying to create a rotating proxy that returns the list of proxies I provide every time it connects, but I failed.
Please how can you create rotating ip
 
Back
Top