aboutsummaryrefslogtreecommitdiffstats
path: root/web/etc/varnish/nms.vcl
diff options
context:
space:
mode:
Diffstat (limited to 'web/etc/varnish/nms.vcl')
-rw-r--r--web/etc/varnish/nms.vcl44
1 files changed, 16 insertions, 28 deletions
diff --git a/web/etc/varnish/nms.vcl b/web/etc/varnish/nms.vcl
index 5f262a6..45b7830 100644
--- a/web/etc/varnish/nms.vcl
+++ b/web/etc/varnish/nms.vcl
@@ -1,25 +1,14 @@
-#
-# This is an example VCL file for Varnish.
-#
-# It does not do anything by default, delegating control to the
-# builtin VCL. The builtin VCL is called when there is no explicit
-# return statement.
-#
-# See the VCL chapters in the Users Guide at https://www.varnish-cache.org/docs/
-# and http://varnish-cache.org/trac/wiki/VCLExamples for more examples.
-
-# Marker to tell the VCL compiler that this VCL has been adapted to the
-# new 4.0 format.
+# Magi.
vcl 4.0;
-# Default backend definition. Set this to point to your content server.
+# Mer magi.
backend default {
.host = "127.0.0.1";
.port = "8080";
}
+# Sort magi.
sub vcl_recv {
-
if (req.method != "GET" &&
req.method != "HEAD" &&
req.method != "PUT" &&
@@ -27,8 +16,8 @@ sub vcl_recv {
req.method != "TRACE" &&
req.method != "OPTIONS" &&
req.method != "DELETE") {
- /* Non-RFC2616 or CONNECT which is weird. */
- return (pipe);
+ # Vi hater alt som er gøy.
+ return (synth(418,"LOLOLOL"));
}
# Hardcoded for testing
@@ -38,37 +27,36 @@ sub vcl_recv {
/* 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 {
+ # Wheee. Legg til authorization-headeren i hashen.
hash_data(req.http.authorization);
}
+# Mauve magi. Hva nå enn det er.
+# Dette er WIP - Skal flyttes til backend
sub vcl_backend_response {
- # Happens after we have read the response headers from the backend.
- #
- # Here you clean the response headers, removing silly Set-Cookie headers
- # and other mistakes your backend does.
- if (!(bereq.http.host ~ "stream")) {
if (beresp.status == 200) {
set beresp.ttl = 2s;
} else {
- set beresp.ttl = 0s;
+ # 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 == 500) {
- return (retry);
- }
- }
-
}