0
먼저 불쌍한 영어를 유감스럽게 생각합니다. 내 자연어가 아닙니다.와니스 쿠키 문제
나는 관리 대상 사용자가 백엔드를 사용하기 위해 쿠키로 바니시를 구성하려고 시도하며 로그온 및 기타 점검에 몇 가지 문제가 있습니다.
backend default {
.host = "127.0.0.1";
.port = "8080";
}
sub vcl_recv {
remove req.http.X-Forwarded-For;
set req.http.X-Forwarded-For = client.ip;
if (req.request == "POST"){
return (pass);
}
# Grace mode
if (! req.backend.healthy) {
set req.grace = 30m;
} else {
set req.grace = 15s;
}
if(req.url ~ "^localhost$"){
set req.http.host = "www.micasa.com";
}
# Acces to system URL's is protected
if ((req.url ~ "^/server_status") || (req.url ~ "^/discover/varnish_server")) {
error 403 "Go away, please";
}
# Delete all cookies except from user
if (!(req.url ~ "^/logout") &&
!(req.url ~ "^/profile") &&
!(req.url ~ "^/playlists") &&
!(req.url ~ "^/users") &&
!(req.url ~ "^/signup") &&
!(req.url ~ "^/comments") &&
!(req.url ~ "^/login") &&
!(req.url ~ "^/remind"))
{
unset req.http.cookie;
}
sub vcl_fetch {
# Grace mode
# https://www.varnish-cache.org/docs/trunk/tutorial/handling_misbehaving_servers.html#grace-mode
set beresp.grace = 30m;
# Saint mode
# https://www.varnish-cache.org/docs/trunk/tutorial/handling_misbehaving_servers.html#saint-mode
if (beresp.status == 500) {
set beresp.saintmode = 10s;
return (restart);
}
if (!(req.url ~ "^/login") && (req.request == "GET")){
unset beresp.http.set-cookie; # To avoid caching of cookies
}
# Process ESIs if X-RUN-ESI is set. This will be stripped before being sent down to client.
if (beresp.http.X-RUN-ESI) {
set beresp.do_esi = true;
remove beresp.http.X-RUN-ESI;
}
# cache 404s and 301s for 5 minute
if (beresp.status == 404 || beresp.status == 301 || beresp.status == 500) {
set beresp.ttl = 15m;
return (deliver);
}
# cache images and static assets during 15m
if (req.url ~ "\.(png|gif|jpg|css|js|ico)") {
set beresp.ttl = 15m;
return (deliver);
}
# If X-VARNISH-TTL is set, use this header's value as the TTL for the varnish cache.
# Expires, cache-control, etc. will be passed directly through to the client
# Cribbed from http://www.lovelysystems.com/configuring-varnish-to-use-custom-http-headers/
if (beresp.http.X-VARNISH-TTL) {
C{
char *ttl;
/* first char in third param is length of header plus colon in octal */
ttl = VRT_GetHdr(sp, HDR_BERESP, "\016X-VARNISH-TTL:");
VRT_l_beresp_ttl(sp, atoi(ttl));
}C
remove beresp.http.X-VARNISH-TTL;
return (deliver);
}
sub vcl_deliver {
unset resp.http.x-url; # Optional
if (req.url ~ "\.(png|gif|jpg|css|js|ico|woff)") {
set resp.http.expires = "3600";
}
#mikel
#remove resp.http.X-Powered-By;
remove resp.http.Server;
#remove resp.http.X-Varnish;
#remove resp.http.Via;
#remove resp.http.Age;
}
sub vcl_hash {
if (req.http.Cookie ~ "_micasa_session") {
hash_data(req.url);
hash_data(req.http.Cookie);
return (hash);
}
}
난 괜찮아 사용자와 loggin에하려고하지만 난 그 후 같은 페이지를 새로 고침하면, 내가 로그 아웃 immediatly 쿠키를 잃고, 어쩌면 문제 : 가져 오기 및 해시 RECV에 대한
내 설정 하위 vcl_recv에 있습니까?
도움을 주셔서 감사합니다.
감사합니다. 클라렌스에 감사드립니다. 나는 당신이 말하는 다른 방법을 연구하지만, 당신은 나의 의심을 분명히합니다. – user2250559