Skip to content
This repository has been archived by the owner on Nov 12, 2020. It is now read-only.

Commit

Permalink
fix Varnish configuration (choose backend first)
Browse files Browse the repository at this point in the history
  • Loading branch information
cupracer committed Nov 15, 2015
1 parent ca23f7a commit d9ac977
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions build/proxy/etc/varnish/vcl.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,8 @@ backend thumbsniper_nginx_panel {
}

sub vcl_recv {
# pass mode can't handle POST (yet)
if (req.request == "POST") {
return(pipe);
}

# don't bother caching large files
if(req.url ~ "\.(pdf|mp3|flv|mov|mp4|mpg|mpeg|avi|dmg)") {
return(pipe);
}

# force lookup even when cookies are present
if (req.request == "GET" && req.http.cookie) {
return(lookup);
}


# THUMBSNIPER
# BACKENDS

if(req.http.host ~ "^(?i)api\.")
{
Expand All @@ -54,6 +39,27 @@ sub vcl_recv {
set req.backend = thumbsniper_nginx_panel;
}


# DEFAULT

# pass mode can't handle POST (yet)
if (req.request == "POST") {
return(pipe);
}

# don't bother caching large files
if(req.url ~ "\.(pdf|mp3|flv|mov|mp4|mpg|mpeg|avi|dmg)") {
return(pipe);
}

# force lookup even when cookies are present
if (req.request == "GET" && req.http.cookie) {
return(lookup);
}


# THUMBSNIPER

if(req.http.host ~ "^(?i)img[0-9]*\.")
{
set req.http.host = regsub(req.http.host, "^(?i)img[0-9]*\.","img\.");
Expand All @@ -63,12 +69,6 @@ sub vcl_recv {
{
return(pass);
}

# if(req.http.host ~ "^(?i)panel\.")
# {
# set req.backend = thumbsniper_nginx_api;
# return(pass);
# }
}


Expand Down

0 comments on commit d9ac977

Please sign in to comment.