我有以下 Nginx 配置:
http {
...
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m;
proxy_temp_path /var/tmp;
...
upstream webhook_staging {
server 127.0.0.1:4001;
keepalive 64;
}
location /webhooks/incoming_mails {
client_max_body_size 60m;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header Connection "";
proxy_http_version 1.1;
# Does not work for HEAD requests
#>> proxy_cache one;
#>> proxy_cache_key $scheme$host$request_uri;
proxy_pass http://webhook_staging;
}
}
Run Code Online (Sandbox Code Playgroud)
上游服务器是一个常规的 Node.js 进程。如果我激活proxy_cache_*
上面的指令,HEAD
请求就会被传递GET
到上游服务器。如果我停用指令,HEAD
请求将作为请求传递HEAD
,一切都很好。
有什么建议么?
谢谢!