Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nginx proxy_pass to a password protected upstream

I want to pass a request to an upstream server. The original url is not password protected but the upstream server is. I need to inject a Basic auth username/password into the request but get errors when doing:

upstream supportbackend {
       server username:[email protected];
}

and

upstream supportbackend {
       server support.yadayada.com;
}

location /deleteuser {
    proxy_pass http://username:password@supportbackend;
}
like image 697
Martin Redmond Avatar asked Jan 23 '10 18:01

Martin Redmond


1 Answers

you need to add proxy_set_header Authorization "Basic ...."; where the .... is base64 of user:pass.

like image 164
nanaya Avatar answered Oct 13 '22 14:10

nanaya