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

 
(같은 사용자의 중간 판 4개는 보이지 않습니다)
1번째 줄: 1번째 줄:
==개요==
==개요==
;how to redirect from www to non-www varnish
;how to redirect from www to non-www varnish
;Varnish www to non-www 리다이렉션
;Varnish www to non-www 넘겨주기
;Varnish www도메인 넘겨주기
;Varnish www도메인 넘겨주기


35번째 줄: 37번째 줄:


==같이 보기==
==같이 보기==
* [[Varnish HTTP→HTTPS 넘겨주기]]
* [[Varnish HTTP to HTTPS 넘겨주기]]
* [[www→비www 넘겨주기]]
* [[www to non-www 리다이렉션]]


==참고==
==참고==
44번째 줄: 46번째 줄:
[[분류: HTTP]]
[[분류: HTTP]]
[[분류: Varnish]]
[[분류: Varnish]]
[[분류: URL 리다이렉션]]

2018년 7월 17일 (화) 11:05 기준 최신판

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 }}