[英]Laravel 7 Cache via Middleware is not accessing the cached content and send X-Proxy-Cache: MISS header
[英]nginx cache always return X-Proxy-Cache: MISS
我將我的nginx
配置如下:
proxy_cache_path /v01/nginx levels=1:2 keys_zone=my_zone:10m inactive=60m;
proxy_cache_key "$scheme$request_method$host$request_uri";
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
charset utf-8;
server_name localhost;
location / {
client_max_body_size 2M;
proxy_cache my_zone;
proxy_cache_bypass $http_cache_control;
add_header X-Proxy-Cache $upstream_cache_status;
include proxy_params;
proxy_pass http://localhost:3000;
}
}
我在一台安裝了nginx/1.4.6 (Ubuntu)
機器上配置這個,我測試:
curl -X GET -I 192.168.1.193/css/style.css
它有效,頭部X-Proxy-Cache: HIT
。
但是我在另一台安裝了nginx/1.6.2 (Ubuntu)
機器上配置了這個, curl -X GET -I 192.168.1.97/css/style.css
總是返回X-Proxy-Cache: MISS
。
我檢查了路徑/v01/nginx
,它什么都沒有。
我發現問題出在哪里:
我沒有在另一台機器的項目中設置node.js緩存,我改變了
app.use express.static config.root + '/public'
至
app.use express.static config.root + '/public', {maxAge: 1000 * 3600 * 24 * 7}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.