Nginx proxy_pass到密码保护上游

时间:2010-01-23 18:07:53

标签: proxy nginx basic-authentication

我想将请求传递给上游服务器。原始URL不受密码保护,但上游服务器是。我需要在请求中注入一个Basic auth用户名/密码,但在执行时会出错:

upstream supportbackend {
       server username:password@support.yadayada.com;
}

upstream supportbackend {
       server support.yadayada.com;
}

location /deleteuser {
    proxy_pass http://username:password@supportbackend;
}

1 个答案:

答案 0 :(得分:12)

您需要在proxy_set_header Authorization "Basic ....";....的base64的位置添加user:pass