diff --git a/examples/varnish.vcl b/examples/varnish.vcl new file mode 100644 index 0000000000000000000000000000000000000000..666cff38933dbb560cd0a3f99ba0d54255110053 --- /dev/null +++ b/examples/varnish.vcl @@ -0,0 +1,38 @@ +backend default { + .host = "127.0.0.1"; + .port = "81"; +} + +sub vcl_recv { + + if (req.http.host ~ "cdn[0-9]\.example.com" && + req.url ~ "\.(gif|jpg|jpeg|png)(\?.*|)$") { + unset req.http.Cache-Control; + unset req.http.Cookie; + unset req.http.Accept-Encoding; + unset req.http.Vary; + return(lookup); + } + +} + +sub vcl_fetch { + + if (req.http.host ~ "cdn[0-9]\.example.com" && + req.url ~ "\.(gif|jpg|jpeg|png)(\?.*|)$") { + unset beresp.http.set-cookie; + set beresp.ttl = 1w; + } + +} + +sub vcl_deliver { + + if (obj.hits > 0) { + set resp.http.X-Cache = "HIT"; + } else { + set resp.http.X-Cache = "MISS"; + } + return(deliver); + +} diff --git a/index.php b/index.php index c46329bb0ca5eb7c30c9d37cb1713c4cfbfbb222..f9bef567b861e1be12ed3dcded7deca36613df30 100644 --- a/index.php +++ b/index.php @@ -652,7 +652,6 @@ $origin_domain = strtolower( $exploded[1] ); $origin_domain_exception = array_key_exists( $origin_domain, $origin_domain_exceptions ) ? $origin_domain_exceptions[$origin_domain] : 0; $scheme = 'http' . ( array_key_exists( 'ssl', $_GET ) ? 's' : '' ) . '://'; - parse_str( ( empty( $parsed['query'] ) ? '' : $parsed['query'] ), $_GET ); $ext = strtolower( pathinfo( $parsed['path'], PATHINFO_EXTENSION ) );