"Varnish www to non-www 넘겨주기"의 두 판 사이의 차이

잔글 (Jmnote님이 Varnish www도메인 넘겨주기 문서를 Varnish www→비www 넘겨주기 문서로 이동했습니다)
36번째 줄: 36번째 줄:
==같이 보기==
==같이 보기==
* [[Varnish HTTP→HTTPS 넘겨주기]]
* [[Varnish HTTP→HTTPS 넘겨주기]]
* [[www→비www 넘겨주기]]


==참고==
==참고==

2018년 7월 17일 (화) 07:22 판

1 개요

how to redirect from www to non-www varnish
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 }}