Help with Default.vcl ; WordPress / phpmyadmin
Miguel González
miguel_3_gonzalez at yahoo.es
Tue Sep 19 22:12:57 UTC 2017
Guillaume, this one got out of my radar ;)
On 09/19/17 10:10 PM, Guillaume Quintard wrote:
>
> - ban("req.url ~ " + req.url + " && req.http.host ~ " +
> req.http.host);
>
> + ban("req.url ~ " + req.url + " && req.http.host ~ " + req.http.host);
>
> bad html formatting, that will should soon will be fixed, thanks.
>
> If there's another issue, please give us the error message.
>
> --
> Guillaume Quintard
>
> On Mon, Sep 18, 2017 at 12:16 AM, Andrew Incorvia <live4life at usa.net
> <mailto:live4life at usa.net>> wrote:
>
> Hello Varnish-cache Community:
>
> Ubuntu 16.04.3
> Varnish-Cache 5.1.3
> Apache 2.4.18
>
> I could use a little help with getting the default.vcl correct for
> use with WP and phpmyadmin
>
> Want I want to do is exclude these paths from varnish:
>
> myipaddress_hostname/phpmyadmin/ [without hardcoding the
> myipaddress_hostname]
>
> and also
>
> myipaddress_hostname/wp-login.php
>
>
> Additionally,
>
> I want to handle cookies correctly as per:
> https://info.varnish-software.com/blog/step-step-speed-wordpress-varnish-software
> <https://info.varnish-software.com/blog/step-step-speed-wordpress-varnish-software>
>
> [This article is old, and I believe the syntax is causing issues as
> I tried, and Varnish-Cache would not start.]
>
> Thanks!
>
> A.I
>
> My default.vcl
>
> #
> # 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/
> <https://www.varnish-cache.org/docs/>
> # and https://www.varnish-cache.org/trac/wiki/VCLExamples
> <https://www.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.
> vcl 4.0;
>
> # Default backend definition. Set this to point to your content server.
> backend default {
> .host = "127.0.0.1";
> .port = "8080";
> }
>
> ### Exluding URLs from Caching ###
> sub vcl_recv {
> if (req.url ~ "^/phpmyadmin/") {
> return (pass);
> }
> }
>
> sub vcl_recv {
> # Happens before we check if we have this in cache already.
> #
> # Typically you clean up the request here, removing cookies you
> don't need,
> # rewriting the request, etc.
>
> if (req.method == "PURGE") {
>
> if (req.http.X-Purge-Method == "regex") {
>
> ban("req.url ~ " + req.url + " && req.http.host ~ " +
> req.http.host);
>
> return (synth(200, "Banned."));
>
> } else {
>
> return (purge);
>
> }
> }
>
> set req.http.cookie = regsuball(req.http.cookie,
> "wp-settings-\d+=[^;]+(; )?", "");
>
> set req.http.cookie = regsuball(req.http.cookie,
> "wp-settings-time-\d+=[^;]+(; )?", "");
>
> set req.http.cookie = regsuball(req.http.cookie,
> "wordpress_test_cookie=[^;]+(; )?", "");
>
> if (req.http.cookie == "") {
>
> unset req.http.cookie;
> }
> }
>
> 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.
> }
>
> sub vcl_deliver {
> # Happens when we have all the pieces we need, and are about to
> send the
> # response to the client.
> #
> # You can do accounting or modifying the final object here.
> }
>
>
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org <mailto:varnish-misc at varnish-cache.org>
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
> <https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc>
>
>
>
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
.
More information about the varnish-misc
mailing list