在下面的反向代理配置中,它會默認有快取行為嗎?
location / {
proxy_pass http://12.23.45.78:8080;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
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 X-Forwarded-Host $host;
add_header Cache-Control no-store;
add_header Pragma no-cache;
}
據我了解,要支持快取,需要添加proxy_cache引數。是不是意味著如果不加這個引數,默認不快取內容?
我不想在反向代理服務器上快取后端回應內容,是否需要添加其他設定來實作這一點?或者現在就足夠了嗎?
還有必要保留以下兩行嗎?它似乎告訴訪問者的瀏覽器不要快取內容,但它是否也告訴反向代理主機不要快取內容(值得懷疑)?這讓我很困惑...
add_header Cache-Control no-store;
add_header Pragma no-cache;
uj5u.com熱心網友回復:
默認情況下proxy_cache是off,因此您不會有任何不需要的快取行為。此外,您可能需要檢查日志以完全確定,據我所知,如果檔案的大小超過其緩沖區配置指令,nginx 會嘗試快取檔案。
和你的指令:
add_header Cache-Control no-store;
add_header Pragma no-cache;
完全是另一回事,它是瀏覽器客戶端,而不是nginx(服務器)。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/471252.html
標籤:nginx 缓存 nginx-反向代理
