0

我在 RoR 应用程序上使用清漆。我在“忘记密码”链接上得到一个重定向循环。我怀疑这是由于 spree gem(后端)而发生的。如何忽略来自清漆狂欢的重定向?

以下是我的vcl:

# This is a basic VCL configuration file for varnish.  See the vcl(7)
import std;
import geoip;

backend back1 {
.host = "localhost";
.port = "81";
.connect_timeout = 5s;
.first_byte_timeout = 10s;
.between_bytes_timeout = 10s;

.probe = {
    .url = "/";
    .interval = 5s;
    .timeout = 10s;
    .window = 5;
    .threshold = 3;
}
}    

backend back2 {
.host = "localhost";
.port = "81";
.connect_timeout = 5s;
.first_byte_timeout = 10s;
.between_bytes_timeout = 10s;

.probe = {
    .url = "/";
.interval = 5s;
    .timeout = 10s;
    .window = 5;
    .threshold = 3;
}
}

acl purge {
  "localhost";
}


director voylla_ms round-robin {
 {
 .backend = back1;
 }

 {
 .backend = back2;
 }
}

sub vcl_recv {
set req.backend = voylla_ms;

if (req.restarts == 0) {
    if (req.http.x-forwarded-for) {
        set req.http.X-Forwarded-For =
        req.http.X-Forwarded-For + ", " + client.ip;
    } else {
        set req.http.X-Forwarded-For = client.ip;
    }
##getting the country code from client IP using geoip
#   set req.http.X-GeoIP = geoip.country(""+"192.189.54.254");
}

if (req.http.Cookie ~ "vy0ln") {
    return(pass);
}


if (req.request != "GET" &&
    req.request != "HEAD" &&
    req.request != "PUT" &&
    req.request != "POST" &&
    req.request != "TRACE" &&
    req.request != "OPTIONS" &&
    req.request != "DELETE") {
/* Non-RFC2616 or CONNECT which is weird. */
    return (pipe);
}

if (req.request != "GET" && req.request != "HEAD") {
/* We only deal with GET and HEAD by default */
    return (pass);
}

## changes made for purging
if(req.request == "PURGE"){
    if(!client.ip ~ purge){
        error 405 "Not Allowed!";
    }
    return (lookup);
}

if ((req.url ~ "^/account") || (req.url ~ "^/user") || (req.url ~ "^/login#") || (req.url ~ "^/orders") || (req.url ~ "^/checkout") || (req.url ~ "^/cod") || (req.url ~ "^/cart") ||  (req.url ~ "^/online_payment") || (req.url ~ "^/wishlists" ) || (req.url ~ "^/admin") || (req.url ~ "^/email_to_friend/") || (req.http.host ~ "payu") || (req.url ~ "^/call_me")){
    return (pass);
}

if ((req.url == "/") || (req.url ~ "^/t/") || (req.url ~ "^/designers") || req.url ~ "^/taxons/" || (req.url ~ "\.(css|js|png|gif|jpeg|jpg|swf|html|ico|txt)$") || (req.url ~ "^/products/") || (req.url ~ "^/ql/") || (req.url ~ "search") || (req.url ~ "^/policy") || (req.url ~ "^/help") || (req.url ~ "^/media") || (req.url ~ "^/about") || (req.url ~ "^/contact") || (req.url ~ "^/career")){
    std.syslog(180, "should be cached: " + req.http.host + req.url);
    return (lookup);
} else {
    std.syslog(180, "should not be cached: "+req.http.host+req.url);
    return (pass);
}

if (req.http.Authorization) {
/* Not cacheable by default */
    return (pass);
}

return (lookup);
} 



sub vcl_fetch {

std.syslog(180, "request cookie is" + req.http.Cookie);
if (req.http.Cookie ~ "vy0ln") {
    return (deliver);
}

if (req.url ~ "^/taxons/sold_out_status.") {
    std.syslog(180, "setting TTL for sold out products");
    set beresp.do_esi = true;
    set beresp.ttl = 1s;
    return(deliver);
}



if ((req.url ~ "^/account") || (req.url ~ "^/user") || (req.url ~ "^/login") || (req.url ~ "^/orders") || (req.url ~ "^/checkout") || (req.url ~ "^/cod") || (req.url ~ "^/cart") ||  (req.url ~ "^/online_payment") || (req.url ~ "^/wishlists" ) || (req.url ~ "^/admin") || (req.url ~ "^/email_to_friend/") || (req.http.host ~ "payu") || (req.url ~ "^/call_me"))
{
    return (deliver);
}

if ((req.url == "/") || (req.url ~ "^/t/") || (req.url ~ "^/designers") || req.url ~ "^/taxons/" || (req.url ~ "\.(css|js|png|gif|jpeg|jpg|swf|html|ico|txt)$") || (req.url ~ "^/products/") || (req.url ~ "^/ql/") || (req.url ~ "search") || (req.url ~ "^/policy") || (req.url ~ "^/help") || (req.url ~ "^/media") || (req.url ~ "^/about") || (req.url ~ "^/contact") || (req.url ~ "^/career")) {
    std.syslog(180, "fetched: " + req.http.host + req.url);
    if (req.url ~ "^/taxons/") {
        set beresp.ttl = 3600s;
        } else {
        set beresp.ttl = 86400s;
    }
    set beresp.http.X-Cacheable = "YES";
    set beresp.http.Cache-Control = "public";
    return (deliver);
    } else {
    std.syslog(180, "a pass: " + req.http.host + req.url);
    return (deliver);
}
# this section of code sets the API to return a response code of 200 not 302.  DO NOT MODIFY OR DELETE COULD MESS UP CLIENTS.
if(beresp.status == 302 && !beresp.http.Location){
set beresp.status = 200; 
set beresp.response = "OK";
}


}

sub vcl_error {
# std.syslog(180, "inside vcl_error")
return (deliver);
}

sub vcl_miss {
std.syslog(180, "inside vcl_miss");
if (req.request == "PURGE"){
    purge;
}
return (fetch);
}

sub vcl_hit {
std.syslog(180, "inside vcl_hit");
if(req.request == "PURGE"){
    purge;
}
return (deliver);
}

sub vcl_deliver {
    std.syslog(180, "inside vcl_deliver");
    std.syslog(180, "response cookie is " + resp.http.Cookie);
    if (obj.hits > 0) {
            set resp.http.X-Cache = "HIT";
    } else {
            set resp.http.X-Cache = "MISS";
    }
return (deliver);
}

sub vcl_hash {
 hash_data(req.url);
 hash_data(req.http.X-Forwarded-Proto);
 return(hash);
#     if (req.http.host) {
#         hash_data(req.http.host);
#     } else {
#         hash_data(server.ip);
#     }
#     return (hash);
}

以下是 varnishlog 的输出:

4 TxHeader     c X-Runtime: 0.007428
4 TxHeader     c X-Rack-Cache: miss
4 TxHeader     c Vary: Accept-Encoding
4 TxHeader     c Content-Encoding: gzip
4 TxHeader     c Content-Length: 117
4 TxHeader     c Accept-Ranges: bytes
4 TxHeader     c Date: Wed, 30 Oct 2013 12:03:25 GMT
4 TxHeader     c X-Varnish: 1346509087
4 TxHeader     c Age: 0
4 TxHeader     c Via: 1.1 varnish
4 TxHeader     c Connection: keep-alive
4 TxHeader     c X-Cache: MISS
4 Length       c 117
4 ReqEnd       c 1346509087 1383134605.871565104 1383134605.884164095 0.198731184 0.012528181 0.000070810
4 Debug        c herding
4 Interrupted  c ReqStart
12 TxRequest    b GET
12 TxURL        b /user/password/new
12 TxProtocol   b HTTP/1.1
12 TxHeader     b host: beta.voylla.com
12 TxHeader     b Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
12 TxHeader     b Accept-Encoding: gzip,deflate,sdch
12 TxHeader     b Accept-Language: en-US,en;q=0.8
12 TxHeader     b Cookie: rv4=1060512134; rv3=1060513775; rv2=1060513789; rv1=1060512380; __atuvc=2%7C42%2C4%7C43; __utma=8135733.481193715.1382614910.1382966468.1383133459.6; __utmb=8135733.1.10.1383133459; __utmc=8135733; __utmz=8135733.1382614910.1.1.utmcsr=(direct)|utm
12 TxHeader     b User-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.114 Safari/537.36
12 TxHeader     b X-Forwarded-Port: 80
12 TxHeader     b X-Forwarded-Proto: http
12 TxHeader     b X-Forwarded-For: 122.167.116.196, 10.130.85.29
12 TxHeader     b X-Varnish: 1346509088
12 RxProtocol   b HTTP/1.1
12 RxStatus     b 301
12 RxResponse   b Moved Permanently
12 RxHeader     b Server: nginx/1.4.1
12 RxHeader     b Date: Wed, 30 Oct 2013 12:03:26 GMT
12 RxHeader     b Content-Type: text/html; charset=utf-8
12 RxHeader     b Transfer-Encoding: chunked
12 RxHeader     b Connection: keep-alive
12 RxHeader     b Status: 301 Moved Permanently
12 RxHeader     b Location: https://beta.voylla.com/user/password/new
12 RxHeader     b X-UA-Compatible: IE=Edge,chrome=1
12 RxHeader     b Cache-Control: no-cache, private
12 RxHeader     b Set-Cookie: _voylla.com_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJWExYjc1ZDM2ZTczMzc4OGIyNTgyYmNjZGE3ZjIxOGMxBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMTJvb0ZReTEya05ocWlNTXlMN2RsYkNlQ2ZXYjZtVzdHODd2a24rbjVxOXM9BjsARg%3D%3D--ae5f33cd9559daf7cf84a22640aa69e9e0ae95d9;
12 RxHeader     b X-Runtime: 0.003554
12 RxHeader     b X-Rack-Cache: miss
12 RxHeader     b Vary: Accept-Encoding
12 RxHeader     b Content-Encoding: gzip
12 Fetch_Body   b 3(chunked) cls 0 mklen 1
12 Length       b 118
12 BackendReuse b back1
4 ReqStart     c 10.130.85.29 25877 1346509088
4 RxRequest    c GET
4 RxURL        c /user/password/new
4 RxProtocol   c HTTP/1.1
4 RxHeader     c host: beta.voylla.com
4 RxHeader     c Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
4 RxHeader     c Accept-Encoding: gzip,deflate,sdch
4 RxHeader     c Accept-Language: en-US,en;q=0.8
4 RxHeader     c Cookie: rv4=1060512134; rv3=1060513775; rv2=1060513789; rv1=1060512380; __atuvc=2%7C42%2C4%7C43; __utma=8135733.481193715.1382614910.1382966468.1383133459.6; __utmb=8135733.1.10.1383133459; __utmc=8135733; __utmz=8135733.1382614910.1.1.utmcsr=(direct)|utm
4 RxHeader     c User-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.114 Safari/537.36
4 RxHeader     c X-Forwarded-For: 122.167.116.196
4 RxHeader     c X-Forwarded-Port: 80
4 RxHeader     c X-Forwarded-Proto: http
4 RxHeader     c Connection: keep-alive
4 VCL_call     c recv pass
4 VCL_call     c hash
4 Hash         c /user/password/new
4 Hash         c http
4 VCL_return   c hash
4 VCL_call     c pass pass
4 Backend      c 12 voylla_ms back1
4 TTL          c 1346509088 RFC 120 -1 -1 1383134606 0 1383134606 0 0
4 VCL_call     c fetch deliver
4 ObjProtocol  c HTTP/1.1
4 ObjResponse  c Moved Permanently
4 ObjHeader    c Server: nginx/1.4.1
4 ObjHeader    c Date: Wed, 30 Oct 2013 12:03:26 GMT
4 ObjHeader    c Content-Type: text/html; charset=utf-8
4 ObjHeader    c Status: 301 Moved Permanently
4 ObjHeader    c Location: https://beta.voylla.com/user/password/new
4 ObjHeader    c X-UA-Compatible: IE=Edge,chrome=1
4 ObjHeader    c Cache-Control: no-cache, private
4 ObjHeader    c Set-Cookie: _voylla.com_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJWExYjc1ZDM2ZTczMzc4OGIyNTgyYmNjZGE3ZjIxOGMxBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMTJvb0ZReTEya05ocWlNTXlMN2RsYkNlQ2ZXYjZtVzdHODd2a24rbjVxOXM9BjsARg%3D%3D--ae5f33cd9559daf7cf84a22640aa69e9e0ae95d9;
4 ObjHeader    c X-Runtime: 0.003554
4 ObjHeader    c X-Rack-Cache: miss
4 ObjHeader    c Vary: Accept-Encoding
4 ObjHeader    c Content-Encoding: gzip
4 Gzip         c u F - 118 107 80 864 874
4 VCL_call     c deliver deliver
4 TxProtocol   c HTTP/1.1
4 TxStatus     c 301
4 TxResponse   c Moved Permanently
4 TxHeader     c Server: nginx/1.4.1
4 TxHeader     c Content-Type: text/html; charset=utf-8
4 TxHeader     c Status: 301 Moved Permanently
4 TxHeader     c Location: https://beta.voylla.com/user/password/new
4 TxHeader     c X-UA-Compatible: IE=Edge,chrome=1
4 TxHeader     c Cache-Control: no-cache, private
4 TxHeader     c Set-Cookie: _voylla.com_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJWExYjc1ZDM2ZTczMzc4OGIyNTgyYmNjZGE3ZjIxOGMxBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMTJvb0ZReTEya05ocWlNTXlMN2RsYkNlQ2ZXYjZtVzdHODd2a24rbjVxOXM9BjsARg%3D%3D--ae5f33cd9559daf7cf84a22640aa69e9e0ae95d9;
4 TxHeader     c X-Runtime: 0.003554
4 TxHeader     c X-Rack-Cache: miss
4 TxHeader     c Vary: Accept-Encoding
4 TxHeader     c Content-Encoding: gzip
4 TxHeader     c Content-Length: 118
4 TxHeader     c Accept-Ranges: bytes
4 TxHeader     c Date: Wed, 30 Oct 2013 12:03:26 GMT
4 TxHeader     c X-Varnish: 1346509088
4 TxHeader     c Age: 0
4 TxHeader     c Via: 1.1 varnish
4 TxHeader     c Connection: keep-alive
4 TxHeader     c X-Cache: MISS
4 Length       c 118
4 ReqEnd       c 1346509088 1383134606.141532421 1383134606.273408175 0.257368326 0.131802797 0.000072956
4 Debug        c herding
4 Interrupted  c ReqStart
15 TxRequest    b GET
15 TxURL        b /user/password/new
15 TxProtocol   b HTTP/1.1
15 TxHeader     b host: beta.voylla.com
15 TxHeader     b Accept:  text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
15 TxHeader     b Accept-Encoding: gzip,deflate,sdch
15 TxHeader     b Accept-Language: en-US,en;q=0.8
15 TxHeader     b Cookie: rv4=1060512134; rv3=1060513775; rv2=1060513789; rv1=1060512380; __atuvc=2%7C42%2C4%7C43; __utma=8135733.481193715.1382614910.1382966468.1383133459.6; __utmb=8135733.1.10.1383133459; __utmc=8135733; __utmz=8135733.1382614910.1.1.utmcsr=(direct)|utm
15 TxHeader     b User-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.114 Safari/537.36
15 TxHeader     b X-Forwarded-Port: 443
15 TxHeader     b X-Forwarded-Proto: https
15 TxHeader     b X-Forwarded-For: 122.167.116.196, 10.130.85.29
15 TxHeader     b X-Varnish: 1346509089
15 RxProtocol   b HTTP/1.1
15 RxStatus     b 302
15 RxResponse   b Found
15 RxHeader     b Server: nginx/1.4.1
15 RxHeader     b Date: Wed, 30 Oct 2013 12:03:26 GMT
15 RxHeader     b Content-Type: text/html; charset=utf-8
15 RxHeader     b Transfer-Encoding: chunked
15 RxHeader     b Connection: keep-alive
15 RxHeader     b Status: 302 Found
15 RxHeader     b Location: http://beta.voylla.com/user/password/new
15 RxHeader     b X-UA-Compatible: IE=Edge,chrome=1
15 RxHeader     b Cache-Control: no-cache, private
15 RxHeader     b Set-Cookie: _voylla.com_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJWExYjc1ZDM2ZTczMzc4OGIyNTgyYmNjZGE3ZjIxOGMxBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMTJvb0ZReTEya05ocWlNTXlMN2RsYkNlQ2ZXYjZtVzdHODd2a24rbjVxOXM9BjsARg%3D%3D--ae5f33cd9559daf7cf84a22640aa69e9e0ae95d9;
15 RxHeader     b X-Runtime: 0.003107
15 RxHeader     b X-Rack-Cache: miss
15 RxHeader     b Vary: Accept-Encoding
15 RxHeader     b Content-Encoding: gzip
15 Fetch_Body   b 3(chunked) cls 0 mklen 1
15 Length       b 117
15 BackendReuse b back2
4 ReqStart     c 10.130.85.29 25877 1346509089
4 RxRequest    c GET
4 RxURL        c /user/password/new
4 RxProtocol   c HTTP/1.1
4 RxHeader     c host: beta.voylla.com
4 RxHeader     c Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
4 RxHeader     c Accept-Encoding: gzip,deflate,sdch
4 RxHeader     c Accept-Language: en-US,en;q=0.8
4 RxHeader     c Cookie: rv4=1060512134; rv3=1060513775; rv2=1060513789; rv1=1060512380; __atuvc=2%7C42%2C4%7C43; __utma=8135733.481193715.1382614910.1382966468.1383133459.6; __utmb=8135733.1.10.1383133459; __utmc=8135733; __utmz=8135733.1382614910.1.1.utmcsr=(direct)|utm
4 RxHeader     c User-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.114 Safari/537.36
4 RxHeader     c X-Forwarded-For: 122.167.116.196
4 RxHeader     c X-Forwarded-Port: 443
4 RxHeader     c X-Forwarded-Proto: https
4 RxHeader     c Connection: keep-alive
4 VCL_call     c recv pass
4 VCL_call     c hash
4 Hash         c /user/password/new
4 Hash         c https
4 VCL_return   c hash
4 VCL_call     c pass pass
4 Backend      c 15 voylla_ms back2
4 TTL          c 1346509089 RFC 120 -1 -1 1383134607 0 1383134606 0 0
4 VCL_call     c fetch deliver
4 ObjProtocol  c HTTP/1.1
4 ObjResponse  c Found
4 ObjHeader    c Server: nginx/1.4.1
4 ObjHeader    c Date: Wed, 30 Oct 2013 12:03:26 GMT
4 ObjHeader    c Content-Type: text/html; charset=utf-8
4 ObjHeader    c Status: 302 Found
4 ObjHeader    c Location: http://beta.voylla.com/user/password/new
4 ObjHeader    c X-UA-Compatible: IE=Edge,chrome=1
4 ObjHeader    c Cache-Control: no-cache, private
4 ObjHeader    c Set-Cookie: _voylla.com_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJWExYjc1ZDM2ZTczMzc4OGIyNTgyYmNjZGE3ZjIxOGMxBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMTJvb0ZReTEya05ocWlNTXlMN2RsYkNlQ2ZXYjZtVzdHODd2a24rbjVxOXM9BjsARg%3D%3D--ae5f33cd9559daf7cf84a22640aa69e9e0ae95d9;
4 ObjHeader    c X-Runtime: 0.003107
4 ObjHeader    c X-Rack-Cache: miss
4 ObjHeader    c Vary: Accept-Encoding
4 ObjHeader    c Content-Encoding: gzip
4 Gzip         c u F - 117 106 80 856 866
4 VCL_call     c deliver deliver
4 TxProtocol   c HTTP/1.1
4 TxStatus     c 302
4 TxResponse   c Found
4 TxHeader     c Server: nginx/1.4.1
4 TxHeader     c Content-Type: text/html; charset=utf-8
4 TxHeader     c Status: 302 Found
4 TxHeader     c Location: http://beta.voylla.com/user/password/new
4 TxHeader     c X-UA-Compatible: IE=Edge,chrome=1
4 TxHeader     c Cache-Control: no-cache, private
4 TxHeader     c Set-Cookie: _voylla.com_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJWExYjc1ZDM2ZTczMzc4OGIyNTgyYmNjZGE3ZjIxOGMxBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMTJvb0ZReTEya05ocWlNTXlMN2RsYkNlQ2ZXYjZtVzdHODd2a24rbjVxOXM9BjsARg%3D%3D--ae5f33cd9559daf7cf84a22640aa69e9e0ae95d9;
4 TxHeader     c X-Runtime: 0.003107
4 TxHeader     c X-Rack-Cache: miss
4 TxHeader     c Vary: Accept-Encoding
4 TxHeader     c Content-Encoding: gzip
4 TxHeader     c Content-Length: 117
4 TxHeader     c Accept-Ranges: bytes
4 TxHeader     c Date: Wed, 30 Oct 2013 12:03:26 GMT
4 TxHeader     c X-Varnish: 1346509089
4 TxHeader     c Age: 0
4 TxHeader     c Via: 1.1 varnish
4 TxHeader     c Connection: keep-alive
4 TxHeader     c X-Cache: MISS
4 Length       c 117
4 ReqEnd       c 1346509089 1383134606.471671820 1383134606.628998280 0.198263645 0.157256603 0.000069857
0 Backend_health - back1 Still healthy 4--X-RH 5 3 5 0.757326 0.264340 HTTP/1.1 200 OK
4 Debug        c herding
4 Interrupted  c ReqStart
12 TxRequest    b GET
12 TxURL        b /user/password/new
12 TxProtocol   b HTTP/1.1
12 TxHeader     b host: beta.voylla.com
12 TxHeader     b Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
12 TxHeader     b Accept-Encoding: gzip,deflate,sdch
12 TxHeader     b Accept-Language: en-US,en;q=0.8
12 TxHeader     b Cookie: rv4=1060512134; rv3=1060513775; rv2=1060513789; rv1=1060512380; __atuvc=2%7C42%2C4%7C43; __utma=8135733.481193715.1382614910.1382966468.1383133459.6; __utmb=8135733.1.10.1383133459; __utmc=8135733; __utmz=8135733.1382614910.1.1.utmcsr=(direct)|utm
12 TxHeader     b User-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.114 Safari/537.36
12 TxHeader     b X-Forwarded-Port: 80
12 TxHeader     b X-Forwarded-Proto: http
12 TxHeader     b X-Forwarded-For: 122.167.116.196, 10.130.85.29
12 TxHeader     b X-Varnish: 1346509090
12 RxProtocol   b HTTP/1.1
12 RxStatus     b 301
12 RxResponse   b Moved Permanently
12 RxHeader     b Server: nginx/1.4.1
12 RxHeader     b Date: Wed, 30 Oct 2013 12:03:26 GMT
12 RxHeader     b Content-Type: text/html; charset=utf-8
12 RxHeader     b Transfer-Encoding: chunked
12 RxHeader     b Connection: keep-alive
12 RxHeader     b Status: 301 Moved Permanently
12 RxHeader     b Location: https://beta.voylla.com/user/password/new
12 RxHeader     b X-UA-Compatible: IE=Edge,chrome=1
12 RxHeader     b Cache-Control: no-cache, private
12 RxHeader     b Set-Cookie: _voylla.com_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJWExYjc1ZDM2ZTczMzc4OGIyNTgyYmNjZGE3ZjIxOGMxBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMTJvb0ZReTEya05ocWlNTXlMN2RsYkNlQ2ZXYjZtVzdHODd2a24rbjVxOXM9BjsARg%3D%3D--ae5f33cd9559daf7cf84a22640aa69e9e0ae95d9;
12 RxHeader     b X-Runtime: 0.002530
12 RxHeader     b X-Rack-Cache: miss
12 RxHeader     b Vary: Accept-Encoding
12 RxHeader     b Content-Encoding: gzip
12 Fetch_Body   b 3(chunked) cls 0 mklen 1
12 Length       b 118
12 BackendReuse b back1
4 ReqStart     c 10.130.85.29 25877 1346509090
4 RxRequest    c GET
4 RxURL        c /user/password/new
4 RxProtocol   c HTTP/1.1
4 RxHeader     c host: beta.voylla.com
4 RxHeader     c Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
4 RxHeader     c Accept-Encoding: gzip,deflate,sdch
4 RxHeader     c Accept-Language: en-US,en;q=0.8
4 RxHeader     c Cookie: rv4=1060512134; rv3=1060513775; rv2=1060513789; rv1=1060512380; __atuvc=2%7C42%2C4%7C43; __utma=8135733.481193715.1382614910.1382966468.1383133459.6; __utmb=8135733.1.10.1383133459; __utmc=8135733; __utmz=8135733.1382614910.1.1.utmcsr=(direct)|utm
4 RxHeader     c User-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.114 Safari/537.36
4 RxHeader     c X-Forwarded-For: 122.167.116.196
4 RxHeader     c X-Forwarded-Port: 80
4 RxHeader     c X-Forwarded-Proto: http
4 RxHeader     c Connection: keep-alive
4 VCL_call     c recv pass
4 VCL_call     c hash
4 Hash         c /user/password/new
4 Hash         c http
4 VCL_return   c hash
4 VCL_call     c pass pass
4 Backend      c 12 voylla_ms back1
4 TTL          c 1346509090 RFC 120 -1 -1 1383134607 0 1383134606 0 0
4 VCL_call     c fetch deliver
4 ObjProtocol  c HTTP/1.1
4 ObjResponse  c Moved Permanently
4 ObjHeader    c Server: nginx/1.4.1
4 ObjHeader    c Date: Wed, 30 Oct 2013 12:03:26 GMT
4 ObjHeader    c Content-Type: text/html; charset=utf-8
4 ObjHeader    c Status: 301 Moved Permanently
4 ObjHeader    c Location: https://beta.voylla.com/user/password/new
4 ObjHeader    c X-UA-Compatible: IE=Edge,chrome=1
4 ObjHeader    c Cache-Control: no-cache, private
4 ObjHeader    c Set-Cookie: _voylla.com_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJWExYjc1ZDM2ZTczMzc4OGIyNTgyYmNjZGE3ZjIxOGMxBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMTJvb0ZReTEya05ocWlNTXlMN2RsYkNlQ2ZXYjZtVzdHODd2a24rbjVxOXM9BjsARg%3D%3D--ae5f33cd9559daf7cf84a22640aa69e9e0ae95d9;
4 ObjHeader    c X-Runtime: 0.002530
4 ObjHeader    c X-Rack-Cache: miss
4 ObjHeader    c Vary: Accept-Encoding
4 ObjHeader    c Content-Encoding: gzip
4 Gzip         c u F - 118 107 80 864 874
4 VCL_call     c deliver deliver
4 TxProtocol   c HTTP/1.1
4 TxStatus     c 301
4 TxResponse   c Moved Permanently
4 TxHeader     c Server: nginx/1.4.1
4 TxHeader     c Content-Type: text/html; charset=utf-8
4 TxHeader     c Status: 301 Moved Permanently
4 TxHeader     c Location: https://beta.voylla.com/user/password/new
4 TxHeader     c X-UA-Compatible: IE=Edge,chrome=1
4 TxHeader     c Cache-Control: no-cache, private
4 TxHeader     c Set-Cookie: _voylla.com_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJWExYjc1ZDM2ZTczMzc4OGIyNTgyYmNjZGE3ZjIxOGMxBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMTJvb0ZReTEya05ocWlNTXlMN2RsYkNlQ2ZXYjZtVzdHODd2a24rbjVxOXM9BjsARg%3D%3D--ae5f33cd9559daf7cf84a22640aa69e9e0ae95d9;
4 TxHeader     c X-Runtime: 0.002530
4 TxHeader     c X-Rack-Cache: miss
4 TxHeader     c Vary: Accept-Encoding
4 TxHeader     c Content-Encoding: gzip
4 TxHeader     c Content-Length: 118
4 TxHeader     c Accept-Ranges: bytes
4 TxHeader     c Date: Wed, 30 Oct 2013 12:03:26 GMT
4 TxHeader     c X-Varnish: 1346509090
4 TxHeader     c Age: 0
4 TxHeader     c Via: 1.1 varnish
4 TxHeader     c Connection: keep-alive
4 TxHeader     c X-Cache: MISS
4 Length       c 118
4 ReqEnd       c 1346509090 1383134606.831753492 1383134606.841119766 0.202755213 0.009296179 0.000070095
4 Debug        c herding
4 Interrupted  c ReqStart
15 TxRequest    b GET
15 TxURL        b /user/password/new
15 TxProtocol   b HTTP/1.1
15 TxHeader     b host: beta.voylla.com
15 TxHeader     b Accept: te xt/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
15 TxHeader     b Accept-Encoding: gzip,deflate,sdch 
15 TxHeader     b Accept-Language: en-US,en;q=0.8
15 TxHeader     b Cookie: rv4=1060512134; rv3=1060513775; rv2=1060513789; rv1=1060512380; __atuvc=2%7C42%2C4%7C43; __utma=8135733.481193715.1382614910.1382966468.1383133459.6; __utmb=8135733.1.10.1383133459; __utmc=8135733; __utmz=8135733.1382614910.1.1.utmcsr=(direct)|utm
15 TxHeader     b User-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.114 Safari/537.36
15 TxHeader     b X-Forwarded-Port: 443
15 TxHeader     b X-Forwarded-Proto: https
15 TxHeader     b X-Forwarded-For: 122.167.116.196, 10.130.85.29
15 TxHeader     b X-Varnish: 1346509091
15 RxProtocol   b HTTP/1.1
15 RxStatus     b 302
15 RxResponse   b Found
15 RxHeader     b Server: nginx/1.4.1
15 RxHeader     b Date: Wed, 30 Oct 2013 12:03:26 GMT
15 RxHeader     b Content-Type: text/html; charset=utf-8
15 RxHeader     b Transfer-Encoding: chunked
15 RxHeader     b Connection: keep-alive
15 RxHeader     b Status: 302 Found
15 RxHeader     b Location: http://beta.voylla.com/user/password/new
15 RxHeader     b X-UA-Compatible: IE=Edge,chrome=1
15 RxHeader     b Cache-Control: no-cache, private
15 RxHeader     b Set-Cookie: _voylla.com_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJWExYjc1ZDM2ZTczMzc4OGIyNTgyYmNjZGE3ZjIxOGMxBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMTJvb0ZReTEya05ocWlNTXlMN2RsYkNlQ2ZXYjZtVzdHODd2a24rbjVxOXM9BjsARg%3D%3D--ae5f33cd9559daf7cf84a22640aa69e9e0ae95d9;
15 RxHeader     b X-Runtime: 0.007156
15 RxHeader     b X-Rack-Cache: miss
15 RxHeader     b Vary: Accept-Encoding
15 RxHeader     b Content-Encoding: gzip
15 Fetch_Body   b 3(chunked) cls 0 mklen 1
15 Length       b 117
15 BackendReuse b back2
4 ReqStart     c 10.130.85.29 25877 1346509091
4 RxRequest    c GET
4 RxURL        c /user/password/new
4 RxProtocol   c HTTP/1.1
4 RxHeader     c host: beta.voylla.com
4 RxHeader     c Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
4 RxHeader     c Accept-Encoding: gzip,deflate,sdch
4 RxHeader     c Accept-Language: en-US,en;q=0.8
4 RxHeader     c Cookie: rv4=1060512134; rv3=1060513775; rv2=1060513789; rv1=1060512380; __atuvc=2%7C42%2C4%7C43; __utma=8135733.481193715.1382614910.1382966468.1383133459.6; __utmb=8135733.1.10.1383133459; __utmc=8135733; __utmz=8135733.1382614910.1.1.utmcsr=(direct)|utm
4

1 回答 1

0

您可以在 vcl_fetch 上捕获重定向代码:

sub vcl_fetch {
  // ..
  if (beresp.status == 307 &&
      /* TO-DO: verify that this work better than 'req.url ~ "imagecache"' */
      beresp.http.Location == req.url &&
      beresp.ttl > 5s) {
    set beresp.ttl = 5s;
    set beresp.http.cache-control = "max-age=5";
  }
  // ..
}

您可以在https://github.com/NITEMAN/varnish-bites/blob/master/varnish3/drupal-base.vcl的上下文中看到它

于 2013-10-28T16:55:25.480 回答