stsefanenko
stsefanenko

Reputation: 111

HaProxy as HttpProxy with list of underlying proxies

Is it possible to configure haproxy as a real http proxy which can forward requests to other proxies? What I want to do: I have a list of working proxies. I want to configure haproxy to proxy via these proxies.

I thought about such case:

frontend proxy
 bind *:80
 default_backend proxyBackend
 option http_proxy
backend proxyBackend
 option http_proxy
 server server1 35.199.76.79:80 
 server server2 198.1.122.29:80 
 balance roundrobin

Example: curl --proxy localhost:80 http://check-host.net/ip I thought that request will go throw proxy server1 or server2. But it fails.

Is it possible? Or who can recommend good solutions?

Upvotes: 1

Views: 2773

Answers (1)

stsefanenko
stsefanenko

Reputation: 111

I found a solution:

global
 daemon
 maxconn 256
defaults
 mode http
 timeout connect 5000ms
 timeout client 50000ms
 timeout server 50000ms
listen stats
 bind *:9999
 stats enable
 stats hide-version
 stats uri /stats
frontend proxy
 bind *:80
 default_backend proxyBackend
 option http_proxy
 option http-use-proxy-header
backend proxyBackend
 server serverName1 35.199.76.79:80
 server serverName2 198.1.122.29:80
 server serverName3 129.213.76.9:3128
 balance roundrobin

For such configuration we have proxy list rotation using haproxy. So great.

Upvotes: 2

Related Questions