Varnish www to non-www 넘겨주기

(Varnish www도메인 넘겨주기에서 넘어옴)

1 개요[ | ]

how to redirect from www to non-www varnish
Varnish www to non-www 리다이렉션
Varnish www to non-www 넘겨주기
Varnish www도메인 넘겨주기
sub vcl_recv {
    if (req.http.host ~ "^www\.") {
        set req.http.location = regsub(req.http.host, "^www\.(.*)", "https://\1");
        return (synth(750, "Moved Permanently"));
    }
}
sub vcl_synth {
    if (resp.status == 750) {
        set resp.http.location = req.http.location;
        set resp.status = 301;
        return (deliver);
    }
}
sub vcl_recv {
    if (req.http.host == "www.example.com") {
        set req.http.location = "https://example.com" + req.url;
        return (synth(750, "Moved Permanently"));
    }
}
sub vcl_synth {
    if (resp.status == 750) {
        set resp.http.location = req.http.location;
        set resp.status = 301;
        return (deliver);
    }
}

2 같이 보기[ | ]

3 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}