Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to rotate between a few http authenticated proxies. But I am unable to plug this into the config file because the url structure is different. It works when i remove the username and pass (but requesting the username and pass of course). Is there a way to send the credentials? If i don't add them i am getting a 407 proxy auth error.

global
        daemon
        maxconn 500

defaults
        mode http
        timeout connect 5000ms
        timeout client 50000ms
        timeout         server 50000ms

frontend rotatingproxies
        bind *:3000
        default_backend rotateproxy
        option http_proxy
        option http-use-proxy-header

backend rotateproxy
        option http_proxy 
        server proxyserver user:pass@domain.com:9999
        server proxyserver user:pass@domain.com:9999

        balance roundrobin
share|improve this question

2 Answers 2

up vote 1 down vote accepted

It does not work this way. You need real server address. If you want to add a user-name and password, there is a solution. You need to first encode them in base64 by hand and add the resulting string in the Proxy-Authorization header. For instance :

$ echo -n user:pass | openssl enc -a
dXNlcjpwYXNz

backend rotateproxy
   server proxy1 ip1:9999
   server proxy2 ip2:9999
   reqadd Proxy-Authorization:\ Basic\ dXNlcjpwYXNz

Your client will have to use haproxy as an explicit proxy however, and you need to remove "option http_proxy".

share|improve this answer
    
Works perfectly. Thanks! –  Vinoth Gopi May 10 '12 at 7:23

I searched through the HAProxy-1.3 documentation, and it does not seem to support what you are asking for.

If you have access to the backend server, I would suggest turning authentication off there, and adding another web-server, e.g. nginx, in front of HAProxy to only do basic http authentication.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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