Squid Cache 没有缓存任何内容 - 每次都出现 TCP_MISS 的结果,请帮我修复配置

Squid Cache 没有缓存任何内容 - 每次都出现 TCP_MISS 的结果,请帮我修复配置

我第一次尝试使用 Squid Cache。我的目标是缓存来自 192.168.0.2:3001 的任何 HTTP 响应,并从缓存中提供服务。

我的配置如下:

http_port 3128
 
acl localnet src 10.0.0.0/8     # RFC1918 possible internal network
acl localnet src 172.16.0.0/12  # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl localnet src fc00::/7       # RFC 4193 local private network range
acl localnet src fe80::/10      # RFC 4291 link-local (directly plugged) machines
 
acl SSL_ports port 443
acl Safe_ports port 80          # http
acl Safe_ports port 21          # ftp
acl Safe_ports port 443         # https
acl Safe_ports port 70          # gopher
acl Safe_ports port 210         # wais
acl Safe_ports port 280         # http-mgmt
acl Safe_ports port 488         # gss-http
acl Safe_ports port 591         # filemaker
acl Safe_ports port 777         # multiling http
acl Safe_ports port 1025-65535  # unregistered ports
 
acl CONNECT method CONNECT
 
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost manager
http_access deny manager
 
http_access allow localnet
http_access allow localhost
http_access deny all
 
coredump_dir /squid/var/cache/squid
 
cache_dir ufs /var/spool/squid 1024 16 256
 
refresh_pattern -i http:\/\/192.168.0.2:3001\/.* 10080 100% 43200  override-lastmod
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
 

我发现的问题是,每次我的客户端通过代理拨打电话时,我都会在日志中看到以下内容:

1664219486.836 10098 10.1.1.70 TCP_MISS/200 492 POSThttp://192.168.0.2:3001/InternalCommunicationServices/消息/电子邮件-HIER_DIRECT/192.168.0.2 应用程序/json

我看到了

‘TCP_MISS’

客户端接收来自远程服务器的响应,但在后续调用中,它继续触发 TCP_MISS,并且我从未设法向客户端发送缓存响应。

我想象问题出在 refresh_pattern 行的某个地方,但我看不出它是什么。

我预期的用例的配置中缺少什么?

相关内容