From d9ac977d771ee766a6042fa439d933b8382e7490 Mon Sep 17 00:00:00 2001 From: Thomas Schulte Date: Sun, 15 Nov 2015 19:50:41 +0100 Subject: [PATCH] fix Varnish configuration (choose backend first) --- build/proxy/etc/varnish/vcl.conf | 44 ++++++++++++++++---------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/build/proxy/etc/varnish/vcl.conf b/build/proxy/etc/varnish/vcl.conf index e0c10be..72df035 100644 --- a/build/proxy/etc/varnish/vcl.conf +++ b/build/proxy/etc/varnish/vcl.conf @@ -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\.") { @@ -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\."); @@ -63,12 +69,6 @@ sub vcl_recv { { return(pass); } - -# if(req.http.host ~ "^(?i)panel\.") -# { -# set req.backend = thumbsniper_nginx_api; -# return(pass); -# } }