N
N
Nadim Zakirov2021-04-21 12:56:15
JavaScript
Nadim Zakirov, 2021-04-21 12:56:15

How to make requests through multiple http proxies at the same time?

Using browser.webRequest.onBeforeSendHeaders I can edit the request headers. Is there any way to manually configure a fully valid request to the http proxy using it? If so, what structure should the request have in terms of the headers sent and the request body itself?

I need this to be able to make requests through different proxies at the same time.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Dubrovin, 2021-04-23
@zkrvndm

HTTP proxies have a slightly different request format than in a normal HTTP request.

GET /somepath HTTP/1.1
Host: example.com

in case of a proxy, the request should be
GET http://example.com/somepath HTTP/1.1
Host: example.com

therefore, either the proxy must support web server-style requests (the so-called transparent proxy), or it must be possible to change not only the headers, but also the request itself. In some proxies, transparent requests are accepted "out of the box", in others (for example, squid) they must be allowed by the appropriate directive, somewhere they may not be supported at all. Whether transparent mode will work in combination with Proxy-Authorization also depends on the proxy.
In the case of HTTPS, header manipulation will not make it possible to work with the proxy, you need to be able to make a separate request (CONNECT) before establishing a TLS connection.
You can solve your problem by setting a local transparent proxy without authentication, which will redirect traffic to the parent proxy with authentication, for example for 3proxy:
auth iponly
allow *
parent 1000 http адрес порт логин пароль
proxy -i127.0.0.1 -p3128

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question