From 69c3e7174b8c8e27c5a468b7d238dcd0988ad276 Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: Wed, 5 Apr 2017 21:49:10 +0000 Subject: [PATCH] Some improvements to kojipkgs vcl Signed-off-by: Patrick Uiterwijk --- roles/varnish/templates/kojipkgs.vcl.j2 | 46 ++++++------------------- 1 file changed, 10 insertions(+), 36 deletions(-) diff --git a/roles/varnish/templates/kojipkgs.vcl.j2 b/roles/varnish/templates/kojipkgs.vcl.j2 index e21c96a4e9..e64137f999 100644 --- a/roles/varnish/templates/kojipkgs.vcl.j2 +++ b/roles/varnish/templates/kojipkgs.vcl.j2 @@ -40,28 +40,11 @@ backend local-apache { .threshold = 3; } } -sub vcl_synth { - set resp.http.Content-Type = "text/html; charset=utf-8"; - set resp.http.Retry-After = "5"; - synthetic( {" - - - "} + resp.status + " " + resp.reason + {" - - -

Error "} + resp.status + " " + resp.reason + {"

-

"} + resp.reason + {"

-

Guru Meditation:

-

XID: "} + req.xid + {"

-
-

Varnish cache server on {{ inventory_hostname }}

- - -"} ); - return (deliver); -} - sub vcl_recv { + set req.backend_hint = apache-local; + unset req.http.cookie; + set req.http.clear-cookies = "yes"; + if (req.method == "PURGE") { if (!client.ip ~ purge) { return (synth(405, "Not allowed")); @@ -69,26 +52,17 @@ sub vcl_recv { return(purge); } - if (req.url ~ "^/repo/") { - if (client.ip ~ repoallowed) { - set req.backend_hint = apache-local; - unset req.http.cookie; - set req.http.clear-cookies = "yes"; - } - else { - return(synth(403, "Access denied.")); - } + if (req.url ~ "^/repo/" && !(client.ip ~ repoallowed)) { + return(synth(403, "Access denied.")); } if (req.url ~ "^/mash/") { - set req.backend_hint = apache-local; return (pipe); } if (req.url ~ "^/compose/") { - set req.backend_hint = apache-local; return (pipe); } -# -# deny the open264 rpms and such -# if (req.url ~ openh264) -# + if (req.url ~ "h264") { + return (pipe); + } + return (hash); }