[英]how do I change the location of the httpd.conf for Apache on windows?
[英]With Apache httpd, how do I configure no caching for a given UserAgent?
我將Apache HTTPD配置為向大多數靜態內容的請求添加緩存頭:
ExpiresActive On
ExpiresDefault "access plus 1 year"
# Force JNLP and BSH files to expire immediately so updates are checked for
# and seen (We need this so we see changes in the dynamic content in both)
ExpiresByType application/x-java-jnlp-file "now"
ExpiresByType application/x-bsh "now"
如何在UserAgent
包含字符串JNLP的任何請求中禁用此緩存? 當請求來自用戶代理JNLP(例如“ User-Agent: JNLP/6.0 javaws/1.6.0_12 (b04) Java/1.6.0_12
”)時,我不想要任何 Cache-Control
或其他與緩存相關的頭文件關於HTTP響應。
我可以根據用戶代理找到幾個配置示例,但我無法弄清楚如何根據用戶代理配置緩存。
您的ExpiresByType
指令看起來是個好主意......如果這還不夠,那么嘗試使用BrowserMatch
:
BrowserMatch JNLP ua_is_jnlp
這將環境變量ua_is_jnlp
設置為用戶代理標頭包含字符串JNLP
任何請求的某個值(還有一個不區分大小寫的變體BrowserMatchNoCase
)。 然后,您可以清除任何緩存標頭
Header unset Cache-Control env=ua_in_jnlp
Header unset Expires env=ua_in_jnlp
雖然如果你想完全禁用緩存,你最好不要設置
Header set Cache-Control no-cache env=ua_in_jnlp
Header set Expires 0 env=ua_in_jnlp
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.