微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

从nginx到squid的反向代理

this类似,我试图在@R_502_5171@后面托管一个squid代理:

example.com – 主要网站

relay.example.com – squid服务器.

到目前为止,当我尝试使用squid代理时,它会抱怨访问非法页面,例如,如果我尝试访问http://www.google.com,我会收到一个无效的URL错误,说明该URL / http://www.google.com(请注意前面的/).任何人都可以建议为什么会发生这种情况,或修复@R_502_5171@或者在squid配置中?

upstream @squid {
    server localhost:3128;
}

server {
    listen 80;
    server_name relay.example.com;

    location / {
        proxy_pass http://@squid/$scheme://$host$uri;

        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Request-URI $request_uri;

        proxy_redirect off;
    }
}

https://imgur.com/qtgrZI9

鱿鱼的日志给出:

1423083723.857      0 127.0.0.1 NONE/400 3530 GET /http://www.google.com/ - HIER_NONE/- text/html

和@R_502_5171@相同的请求:

12.34.56.78 - - [04/Feb/2015:16:02:03 -0500] "GET http://www.google.com/ HTTP/1.1" 400 3183 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:35.0) Gecko/20100101 Firefox/35.0" "-"

解决方法:

在@R_502_5171@中:

proxy_pass http://@squid;

在鱿鱼:

http_port 3128 vhost

这就是修复这个https://imgur.com/qtgrZI9错误所需要的一切

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐