2012-03-28 6 views
0

ubuntu 11でニス3.0を使用しています - リダイレクトはexpressjs(v2.5.8 - running node.js 0.6)で処理されています - リダイレクトはexpressで呼び出されます)、間にワニスを使用すると、新しいページへのリダイレクトがブロックされます(「Error 302 found」と表示されます)。ニスの使用中にhtmlリダイレクトがブロックされる

varnish用のvcl設定ファイルで、URLとReferer(vcl_recvセクションのサブセクション)に基づいて渡しを試みましたが、設定ミスをしているようです(または設定ステップを追加する必要があります)。 vclファイルの変更に対する考え/提案は、ワニスがexpressjを新しいページにリダイレクトできるようにするために非常に歓迎されます。

ありがとうございます。

+0

私はまた、sub_vcl_fetchセクションで(返り)を渡そうとしています。どんな提案も大歓迎です。 –

+0

はsub_vcl_fetchセクションを修正して解決しました - 私はすぐにここに投稿します - それが助けてくれることを願っています。 –

答えて

0

sub_vcl_fetchを変更すると修正されました。

サブvcl_fetch {このことができます

# Do not cache the object if the backend application does not want us to. 
if (beresp.http.Cache-Control ~ "(no-cache|no-store|private|must-revalidate)") { 
return(pass); 
} 

# Do not cache the object if the status is not in the 200s 
if (beresp.status >= 300) { 
# Remove the Set-Cookie header 
#remove beresp.http.Set-Cookie; 
return(pass); 
} 

# 
# Everything below here should be cached 
# 
# Remove the Set-Cookie header 
####remove beresp.http.Set-Cookie; 

# Set the grace time 
set beresp.grace = 1s; 

# Static assets aren't served out of Varnish just yet, but when they are, this will 
# make sure the browser caches them for a long time. 
if (req.url ~ "\.(css|js|jpg|jpeg|gif|ico|png)\??\d*$") { 
/* Remove Expires from backend, it's not long enough */ 
unset beresp.http.expires; 

/* Set the clients TTL on this object */ 
set beresp.http.cache-control = "public, max-age=31536000"; 

/* marker for vcl_deliver to reset Age: */ 
set beresp.http.magicmarker = "1";} else { 
set beresp.http.Cache-Control = "private, max-age=0, must-revalidate"; 
set beresp.http.Pragma = "no-cache";} 

## If the request to the backend returns a code other than 200, restart the loop 
## If the number of restarts reaches the value of the parameter max_restarts, 
## the request will be error'ed. max_restarts defaults to 4. This prevents 
## an eternal loop in the event that, e.g., the object does not exist at all. 
if (beresp.status != 200 && beresp.status != 403 && beresp.status != 404) { 
restart; 
} 


if (beresp.status == 302) { 
return(deliver);} 
# return(deliver); the object 
return(deliver); 
} 

希望:

私は以下の私のVCLファイルからsub_vcl_fetchセクションの一部をコピーしました!

関連する問題