I set forward proxy server using apache mod_proxy, which connects to 20 other proxy servers using ProxyRemote feature.

You can set just one URL for ProxyRemote , in my case it's proxy.mydomain.com:8085

I set round-robin for this subdomain with 20 different proxy IP addresses. nslookup and ping proves that round-robin works properly.

When I use this setup ProxyRemote is using only machine from the closest subnet to its IP.

So for example if my machine is

and my proxies are

and so on...

it always uses and never the others.

I have no idea why this happens and I really need one proxy machine which uses other 20 proxies.

The idea is to create one proxy machine which connects to the target URL with random IP everytime.

  • The fact that the closest Proxy from the requested IP is used seems quite good to me...I mean, if you need to go from "New York" to "L.A", the use of a Proxy in "Denver" is more straight-forward than the use of a Proxy in "Paris". It would be interesting to test what happens if Proxy is down...Do you run your test always from the same location ? – krisFR May 19 '15 at 0:50
  • Yes, I removed 91.222... from DNS round-robin and 5.8.... was in use all the time. I agree it's good but I set round-robin to make IP circle and each IP should be used , no matter location. My question is how to set apache NOT TO choose the closest location and respect round-robin order. – knm May 19 '15 at 9:59

I just got hit by that problem. This is because getaddrinfo implements precedednce sorting with common prefix length as detailed in RFC3484/2.2.

You can adjust this behavior by editing /etc/gai.conf

  • I use centos and it looks like I don't have gai.conf in /etc. The only location I found it is /usr/share/doc/glibc-common-2.5 , I can copy it to etc but then what should I uncomment/set to get it working ? – knm Oct 28 '15 at 12:27
  • do i need to type each ip there ? could you add more details. just read man gai.conf but still don't really understand how to config my ipv4 proxy IPs there. – knm Nov 1 '15 at 23:40

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.