Nginx反向代理一个有密码的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 support.yadayada.com;
}

location /deleteuser {
    proxy_pass http://username:[email protected];
}

方法:

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

发表评论

电子邮件地址不会被公开。 必填项已用*标注

This blog is kept spam free by WP-SpamFree.