AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[http-caching](server)

Martin Hope
user706420
Asked: 2021-06-29 00:49:44 +0800 CST

带有标志 [L] 的 RewriteRule 停止缓存?

  • 1

我将服务器管理软件 plesk 与 apache 和 nginx 一起使用。我在 apache 和 nginx 中为 javascript 文件设置了一个过期的标头一年。那行得通。我可以在标题中看到“过期”的一年。

现在我想通过重写(无重定向)访问 javascript 和 php 文件。

阿帕奇

ExpiresActive On
ExpiresByType text/javascript A31556952

RewriteEngine On
RewriteRule fake/(.+\.(?:js|php))$ original/$1 [L]

NGINX

location ~* ^/(.*\.js)$ {
    try_files $uri @fallback;

    expires 1y;
    add_header Cache-Control "public";
}

该 RewriteRule 正在工作。我可以访问这些文件,但是“fake/file.js”中的“expires”标头消失了。我究竟做错了什么?

example.com/original/file.js = 一年后到期

example.com/fake/file.js = 没有过期标头

解决方案 所有静态文件通常由 NGINX 处理,而不是 apache。所以在 apache 中为 javascript 设置这一行给它一个缓存。

标头集 Cache-Control "max-age=31556952, public"

RewriteRule 中的标志 [L] 必须停止 nginx 处理静态文件,并且忽略 ExpiresByType。

mod-rewrite http-caching
  • 1 个回答
  • 128 Views
Martin Hope
Bikash Bhandari
Asked: 2021-02-28 09:11:14 +0800 CST

将 Squid 代理与匿名开放代理集成以缓存来自匿名代理的 html 响应

  • 0

我需要使用 squid 缓存服务器缓存来自匿名代理的 html 响应。但是我的要求是给定的:

从客户端机器我需要使用凭据 IP 和端口连接到匿名代理。我的所有请求都通过本地 squid 代理服务器路由。

我尝试在 squid 上使用给定的配置,但在连接到源时无法缓存响应,如下所示:

squidclinet -h <IP-Anonymous_Proxy> -p <Port> -u <username> -w <Password> <https://www.example.com>

但是我可以使用以下方法进行缓存:

squidclient -h  <IP-squid_proxy> -p  <Port>  -u <username> -w <Password>

我的 squid.conf 文件

# General

http_port 3128
visible_hostname Proxy
forwarded_for delete
via off

# Log

logformat squid %tg.%03tu %6tr %>a %Ss/%03>Hs %<st %rm %ru %[un %Sh/%<a %mt
access_log /var/log/squid/access.log squid

# Cache

cache_dir aufs /var/cache/squid 1024 16 256
coredump_dir /var/spool/squid

acl QUERY urlpath_regex cgi-bin \?
cache deny QUERY

refresh_pattern ^ftp:           1440    20%     10080
refresh_pattern ^gopher:        1440    0%      1440
refresh_pattern -i (/cgi-bin/|\?) 0     0%      0


# Network ACL

acl localnet src 10.0.0.0/8     # RFC 1918 possible internal network

# Port ACL

acl SSL_ports port 443          # https
acl SSL_ports port 563          # snews
acl SSL_ports port 873          # rync
acl Safe_ports port 80 8080     # http
acl Safe_ports port 21          # ftp
acl Safe_ports port 443 563     # https
acl Safe_ports port 70          # gopher
acl Safe_ports port 210         # wais
acl Safe_ports port 1025-65535  # unregistered ports
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 purge method PURGE
acl CONNECT method CONNECT
###Cache Peer
cache_peer <Anonymous-Proxy> parent <Port> 0 no-query default login=username:password
never_direct allow all

http_access allow all
icp_access allow all
#always_direct allow all

# Request Headers Forcing

request_header_access Allow allow all
request_header_access Authorization allow all
request_header_access WWW-Authenticate allow all
request_header_access Proxy-Authorization allow all
request_header_access Proxy-Authenticate allow all
request_header_access Cache-Control allow all
request_header_access Content-Encoding allow all
request_header_access Content-Length allow all
request_header_access Content-Type allow all
request_header_access Date allow all
request_header_access Expires allow all
request_header_access Host allow all
request_header_access If-Modified-Since allow all
request_header_access Last-Modified allow all
request_header_access Location allow all
request_header_access Pragma allow all
request_header_access Accept allow all
request_header_access Accept-Charset allow all
request_header_access Accept-Encoding allow all
request_header_access Accept-Language allow all
request_header_access Content-Language allow all
request_header_access Mime-Version allow all
request_header_access Retry-After allow all
request_header_access Title allow all
request_header_access Connection allow all
request_header_access Proxy-Connection allow all
request_header_access User-Agent allow all
request_header_access Cookie allow all
request_header_access All deny all

# Response Headers Spoofing

reply_header_access Via deny all
reply_header_access X-Cache deny all
reply_header_access X-Cache-Lookup deny all
proxy squid http-caching
  • 1 个回答
  • 394 Views
Martin Hope
Riccardo
Asked: 2020-12-17 06:08:10 +0800 CST

缓存 Chromebook 更新:来自非代理配置客户端的本地缓存?

  • 2

在尝试设置不起作用的东西之前,我想了解以下配置是否具有逻辑。

基本上,我们希望阻止 Chromebook 窃取更新带宽。Google 建议设置一个本地 Web 缓存服务器,以便将请求dl.google.com缓存在 LAN 中,为每台 Chromebook 节省 400mb 的在线请求。

这可以通过设置本地 Web 缓存代理(鱿鱼?)并在 Chromebook 配置中将其声明为代理来完成,但是,因为我只想将请求限制到本地 Web 缓存服务器,仅此dl.google.com而已,我想我可以在 LAN 的 DNS 服务器上创建本地 DNS 记录,以便将请求dl.google.com转发到本地代理。

在您看来,这会起作用,还是代理会拒绝/忽略来自本质上未配置为使用代理的主机的请求?

proxy squid nginx http-caching chrome-os
  • 1 个回答
  • 122 Views
Martin Hope
Albert
Asked: 2020-03-13 04:52:07 +0800 CST

使用 SSL 进行 Web 缓存的建议/建议

  • 0

我一直在为几个网站使用 Varnish Cache。但是,我需要有关实施 HTTPS 的建议。我对 Varnish Cache 的替代品持开放态度。Varnish 的配置相对复杂,所以也许一个不太先进的替代方案更适合我的网站。

Cloudflare 看起来是一个可行的选择,但据我所见,需要一个每月 200 美元起的商业计划。我可能弄错了。

有什么建议吗?

varnish https reverse-proxy cloudflare http-caching
  • 1 个回答
  • 365 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve