【问题标题】:squid remove leading slash from target url鱿鱼从目标网址中删除前导斜杠
【发布时间】:2017-09-19 22:31:19
【问题描述】:

我正在将 squid 配置为转发请求的代理,并打算只允许对 example.com 的请求。这是从我的浏览器发出的请求:http://111.222.333.444/http://example.com 其中 111.222.333.444 是安装 squid 的代理服务器的 IP。

但是我收到 Invalid URL 错误,而服务器正在尝试获取 /http://example.com(注意前导斜杠),这里是访问日志记录:

1505858815.396      0 12.34.56.78 NONE/400 3687 GET /http://example.com - NONE/- text/html

这是我正在使用的配置

acl manager proto cache_object
acl localhost src 127.0.0.1/32 ::1
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
acl localnet src all            # Allow access from everywhere

acl SSL_ports port 443
acl Safe_ports port 80          # http
acl CONNECT method CONNECT
acl safe_url url_regex example\.com.*

http_access allow safe_url
http_access deny all
http_access allow manager localhost
http_access deny manager

http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localnet
http_access allow localhost
http_access deny all
http_port 80
coredump_dir /var/spool/squid
refresh_pattern ^ftp:           1440    20%     10080
refresh_pattern ^gopher:        1440    0%      1440
refresh_pattern -i (/cgi-bin/|\?) 0     0%      0
refresh_pattern .               0       20%     4320

我做错了什么?

【问题讨论】:

    标签: proxy squid


    【解决方案1】:

    知道了! squid 是代理,因此需要与服务器进行代理连接。如果使用 firefox,可以通过设置代理并输入代理服务器 IP 和端口号来完成。在这种情况下可以直接使用完成后的 URL,直接在导航栏中使用:http://example.com

    详细了解如何在 FirefoxChrome 上设置代理

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-04-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-18
      • 2013-04-20
      • 1970-01-01
      相关资源
      最近更新 更多