diff options
| author | Kristian Lyngstol <kristian@bohemians.org> | 2016-02-21 14:55:01 +0100 | 
|---|---|---|
| committer | Kristian Lyngstol <kristian@bohemians.org> | 2016-02-21 14:55:01 +0100 | 
| commit | dd93f2678b3fc6bd5c038a8f69d324790f9d8f4d (patch) | |
| tree | 800c83d4dfd23275c36e4b555431a85334140f80 | |
| parent | 948d70113588e8e9609f8c36dc2c94e5a2a30615 (diff) | |
nms/varnish: Reindenter vcl
| -rw-r--r-- | web/etc/varnish/nms.vcl | 81 | 
1 files changed, 41 insertions, 40 deletions
diff --git a/web/etc/varnish/nms.vcl b/web/etc/varnish/nms.vcl index 45b7830..e4b4747 100644 --- a/web/etc/varnish/nms.vcl +++ b/web/etc/varnish/nms.vcl @@ -1,3 +1,5 @@ +# vim: ts=8:expandtab:sw=4:softtabstop=4 +  # Magi.  vcl 4.0; @@ -9,31 +11,31 @@ backend default {  # Sort magi.  sub vcl_recv { -     if (req.method != "GET" && -       req.method != "HEAD" && -       req.method != "PUT" && -       req.method != "POST" && -       req.method != "TRACE" && -       req.method != "OPTIONS" && -       req.method != "DELETE") { -	 # Vi hater alt som er gøy. -         return (synth(418,"LOLOLOL")); -     } - -     # Hardcoded for testing -     set req.http.host = "nms.tg16.gathering.org";  - -     if (req.method != "GET" && req.method != "HEAD") { -         /* We only deal with GET and HEAD by default */ -         return (pass); -     } - -     # Brukes ikke. Cookies er for nubs.  -     unset req.http.Cookie; - -     # Tvinges gjennom for å cache med authorization-skrot. -     return (hash); - } +    if (req.method != "GET" && +        req.method != "HEAD" && +        req.method != "PUT" && +        req.method != "POST" && +        req.method != "TRACE" && +        req.method != "OPTIONS" && +        req.method != "DELETE") { +        # Vi hater alt som er gøy. +        return (synth(418,"LOLOLOL")); +    } + +    # Hardcoded for testing +    set req.http.host = "nms.tg16.gathering.org";  + +    if (req.method != "GET" && req.method != "HEAD") { +        /* We only deal with GET and HEAD by default */ +        return (pass); +    } + +    # Brukes ikke. Cookies er for nubs. +    unset req.http.Cookie; + +    # Tvinges gjennom for å cache med authorization-skrot. +    return (hash); +}  # Rosa magi  sub vcl_hash { @@ -44,19 +46,18 @@ sub vcl_hash {  # Mauve magi. Hva nå enn det er.  # Dette er WIP - Skal flyttes til backend  sub vcl_backend_response { -	    if (beresp.status == 200) { -		    set beresp.ttl = 2s; -	    } else { -		    # Vi cacher feilmeldinger, fordi vi er kule. -		    set beresp.ttl = 1s; -	    } - -	    if(bereq.url ~ "port-state.pl" && beresp.status == 200) { -		    set beresp.ttl = 1s; -	    } -	    if (beresp.status == 200 && bereq.url ~ "now=") { -		    # Historisk data kan vi cache cirka evig -		    set beresp.ttl = 60m; -	    } +    if (beresp.status == 200) { +        set beresp.ttl = 2s; +    } else { +        # Vi cacher feilmeldinger, fordi vi er kule. +        set beresp.ttl = 1s; +    } + +    if(bereq.url ~ "port-state.pl" && beresp.status == 200) { +        set beresp.ttl = 1s; +    } +    if (beresp.status == 200 && bereq.url ~ "now=") { +        # Historisk data kan vi cache cirka evig +        set beresp.ttl = 60m; +    }  } -  | 
