server { listen 80; server_name localhost; location /sk { proxy_pass http://host:9000/xxx; proxy_set_header Authorization "Basic Z3Vlc3Q6Z3Vlc3Q"; }
返回: 400 Bad Request nginx 日志: No connection could be made because the target machine actively refused it
直接写 proxy_pass http://user:password@host:9000/xxx; nginx 甚至无法启动
代理这种需要验证的地址, 该怎么配置的?
1 znnspace 2019-12-06 17:21:18 +08:00 |
2 aoscici2000 OP @znnspace 不是这个吧, 我要的是代理的目标网站设置了验证, 不是需要设置验证 |
3 sleepm 2019-12-06 17:53:43 +08:00 nginx 只管代理过去,响应回来验证还是要访客去输入的 |
4 aoscici2000 OP @sleepm 那直接提供密码不能由 nginx 去做验证吗, 假设我要用消息队列的话, nginx 不能直接把请求送进队列也有点说不过去啊? |
![]() | 5 Vegetable 2019-12-06 18:16:16 +08:00 确定不是 token 写错了? |
6 rubycedar 2019-12-06 18:24:52 +08:00 看上游的 log 啊 |
7 aoscici2000 OP @Vegetable 没写错,故意写个错的反而能正常返回提示信息... |
8 sleepm 2019-12-06 19:38:30 +08:00 via Android @aoscici2000 那你请求 nginx 的时候带上认证的头不就行了,nginx 一块转发了 |
9 mikeguan 2019-12-07 11:51:09 +08:00 via Android 搜索的是需要 user:passwd 进行 base64,看你的配置也不像是 base64 |