0

我在同一個虛擬服務器上設置了一個實時網站和分段版本。實時站點使用Varnish並且不進行身份驗證,分段站點繞過Varnish但使用摘要身份驗證。在我的VCL文件,我有這樣的:導致uri不匹配的清漆和摘要身份驗證

sub vcl_recv { 
    if (req.http.Authorization || req.http.Authenticate) { 
     return(pass); 
    } 

    if (req.http.host != "live.site.com") { 
     return(pass); 
    } 

我的臨時網站,從而與任何查詢字符串資源沒有被服務看到一個問題 - 在Firebug我看到「400錯誤的請求」,並在Apache日誌這個:

[Fri Sep 19 11:13:03 2014] [error] [client 127.0.0.1] Digest: uri mismatch - 
    </wp-content/plugins/jetpack/modules/wpgroho.js?ver=3.9.2> does not match 
    request-uri </wp-content/plugins/jetpack/modules/wpgroho.js>, referer: 
    http://stage.site.com/ 

我做錯了什麼,有誰知道如何解決這個問題?

感謝,

託比

回答

0

好了,找到了,這裏是我的發現(如果它可以幫助其他人):

我這樣做,當然,在我的上光油VCL節可以消除靜態文件查詢字符串,以幫助緩存:

if (req.request ~ "^(GET|HEAD)$" && req.url ~ "\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|html|htm)(\?.*)?$") { 
    if (req.url ~ "nocache") { 
     return(pass); 
    } 
    set req.url = regsub(req.url, "\?.*$", ""); 
    unset req.http.Cookie; 
    set req.grace = 2m; 
    return(lookup); 
} 

這顯然與摘要式身份驗證衝突,所以我將不得不重新考慮VCL的一部分。

UPDATE我剛換了第二個條件來:

if (req.http.Authorization || req.http.Authenticate || 
     req.url ~ "nocache") { 
     return(pass); 
    }