바니시 리디렉션 루프

바니시 리디렉션 루프

나는 많은 광택 구성을 시도했지만 항상 동일한 리디렉션 루프를 경험했습니다. 광택이 몇 시간 동안 실행된 후 일부 페이지에 The page isn't redirecting properlyFirefox에서 메시지가 표시됩니다.여기에 이미지 설명을 입력하세요

이미지에서 볼 수 있듯이 첫 번째 요청은 301 상태 코드를 반환하고 나머지는 302입니다. 이 302 상태 코드가 어디에 있는지 전혀 모릅니다. 내 nginx 구성에는 다음이 있습니다.

# We don't want someone to visit a default site via IP
# So we catch all non-defined Hosts or blank hosts here
# the default listen will cause this server block to be used
# when no matching hostname can be found in other server blocks
server {
    # use default instead for nginx 0.7.x, default_server for 0.8.x+
    listen 81 default_server;
    # if no listen is specified, all IPv4 interfaces on port 80 are listened to
    # to listen on both IPv4 and IPv6 as well, listen [::] and 0.0.0.0 must be specified. 
    server_name _;
    return 301 $scheme://elbauldelprogramador.com$request_uri;
}

사이트 활성화/mysite에서:

server {
    listen 127.0.0.1:81;
    server_name www.elbauldelprogramador.com;
    return 301 $scheme://elbauldelprogramador.com$request_uri;
}
server {
    listen 127.0.0.1:81;
    server_name elbauldelprogramador.com

    #rest of configuration
}

어쩌면 그 301 리디렉션이 문제일까요? 현재 내 현재 광택 구성은 다음과 같습니다(비록 제가 증명한 모든 구성에서 발생하지만).

# Enter your backend Wordpress site here.
backend default {
    .host = "127.0.0.1"; # XXX CHANGE THIS
    .port = "81";        # (and maybe this)
    .connect_timeout = 60s;
    .first_byte_timeout = 60s;
    .between_bytes_timeout = 60s;
    .max_connections = 800;
}   

acl purge {
    "127.0.0.1";
}

# Drop any cookies sent to Wordpress.
sub vcl_recv {
    if (req.request == "PURGE") {
        if (!client.ip ~ purge) {
            error 405 "Not allowed.";
        }
        return (lookup);
    }

    if (req.http.host ~ "(?i)^(www.)?elbauldelprogramador.com") {
        set req.http.host = "elbauldelprogramador.com";
    }

    # Normalize encoding
    if (req.http.Accept-Encoding) {
        if (req.url ~ "\.(jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg)$") {
            # No point in compressing these
            remove req.http.Accept-Encoding;
        } elsif (req.http.Accept-Encoding ~ "gzip") {
            set req.http.Accept-Encoding = "gzip";
        } elsif (req.http.Accept-Encoding ~ "deflate") {
            set req.http.Accept-Encoding = "deflate";
        } else {
            # unknown algorithm
            remove req.http.Accept-Encoding;
        }
    }
    if (!(req.url ~ "wp-(login|admin|cron)")) {
        unset req.http.cookie;
    }
}

# Drop any cookies Wordpress tries to send back to the client.
sub vcl_fetch {
    if (!(req.url ~ "wp-(login|admin)")) {
        unset beresp.http.set-cookie;
    }
}

sub vcl_hit {
    if (req.request == "PURGE") {
        purge;
        error 200 "Purged.";
    }
}

sub vcl_miss {
    if (req.request == "PURGE") {
        purge;
        error 200 "Purged.";
    }
}

관련 정보