跳转至

Squid 隐藏头部信息


2015-01-07 by dongnan

环境

软件版本: squid 3.x
代理模式: 正向代理

默认配置

# 执行命令
wget -S http://bbs.wst.cn

--2015-01-07 16:53:48--  http://bbs.wst.cn/
Resolving bbs.wst.cn... 58.215.61.20
Connecting to bbs.wst.cn|58.215.61.20|:80... connected.
HTTP request sent, awaiting response...
  HTTP/1.0 502 Bad Gateway
  Server: squid/3.x.x
  Mime-Version: 1.0
  Date: Wed, 07 Jan 2015 08:54:53 GMT
  Content-Type: text/html
  Content-Length: 3233
  X-Squid-Error: ERR_READ_ERROR 104
  Vary: Accept-Language
  Content-Language: en
  X-Cache: MISS from cache.htt.cloud
  X-Cache-Lookup: MISS from cache.htt.cloud:8080
  Via: 1.0 cache.htt.cloud (squid/3.x.x)
  Connection: keep-alive
2015-01-07 16:53:50 ERROR 502: Bad Gateway.

注意,返回响应中的 X-Squid-Error X-Cache xxx Via 等头部信息。

关闭 X-Cache Header

添加以下配置参数

# request
request_header_access Via deny all
request_header_access X-Forwarded-For deny all
request_header_access All allow all

# reply
reply_header_access Server deny all
reply_header_access X-Cache deny all
reply_header_access X-Cache-Lookup deny all
reply_header_access Warning deny all
reply_header_access Expires deny all
reply_header_access Cache-Control deny all
reply_header_access age deny all

返回结果

# 执行命令
wget -S http://bbs.wst.cn

--2015-01-07 17:08:38--  http://bbs.wst.cn/
Resolving bbs.wst.cn... 58.215.61.20
Connecting to bbs.wst.cn|58.215.61.20|:80... connected.
HTTP request sent, awaiting response...
  HTTP/1.0 502 Bad Gateway
  Mime-Version: 1.0
  Date: Wed, 07 Jan 2015 09:09:43 GMT
  Content-Type: text/html
  Content-Length: 3233
  X-Squid-Error: ERR_READ_ERROR 104
  Vary: Accept-Language
  Content-Language: en
  Via: 1.0 cache.htt.cloud (squid/3.x.x)
  Connection: keep-alive
2015-01-07 17:08:39 ERROR 502: Bad Gateway.

注意,返回响应中已经没有 X-Cache xxx 等头部信息,但是仍然有 Via 头部信息。

关闭 Via Header

添加以下配置参数

via off
#...省略

返回结果

# 执行命令
wget -S http://bbs.wst.cn

--2015-01-07 17:37:05--  http://bbs.wst.cn/
Resolving bbs.wst.cn... 58.215.61.20
Connecting to bbs.wst.cn|58.215.61.20|:80... connected.
HTTP request sent, awaiting response...
  HTTP/1.0 502 Bad Gateway
 Mime-Version: 1.0
  Date: Wed, 07 Jan 2015 09:38:11 GMT
  Content-Type: text/html
  Content-Length: 3233
  X-Squid-Error: ERR_READ_ERROR 104
  Vary: Accept-Language
  Content-Language: en
  Connection: keep-alive
2015-01-07 17:37:07 ERROR 502: Bad Gateway.

注意,返回响应中已经没有 Via 头部信息。

添加以下配置参数

via off
reply_header_access All deny all

返回结果

wget -S http://bbs.wst.cn

--2015-01-07 17:35:17--  http://bbs.wst.cn/
Resolving bbs.wst.cn... 58.215.61.20
Connecting to bbs.wst.cn|58.215.61.20|:80... connected.
HTTP request sent, awaiting response...
  HTTP/1.0 502 Bad Gateway
2015-01-07 17:35:19 ERROR 502: Bad Gateway.

参考

隐藏squid头部信息

回到页面顶部