On 12/17/15 9:49 AM, Xavier Cardil Coll wrote:
Hi, I am using this config for a wordpress-woocommerce with mod_pagespeed, but something weird happens on when I try to log in or register a user. I have made sure the /my-account/ is not cached and that the POST request to send the data at login / register is not cached, actually it works. Users login and register, but after one of those actions, the server returns the same form page with the form being empty, while it should return the "my account" page with the data of the user logged in. Can you please shed some light ?

Here is the pasta of my config : http://pastebin.com/3NnW0Sbp

Thanks !

--

Hi Xavier,

Two things jump out at me.

1) You have several matching rules with extraneous '*' characters. For example, your vcl line 91

if(req.url ~ "^/(cart|my-account/*|checkout|addons|logout|lost-password|product/*)"){

Since we are using the "~" match, this might be better represented by

if ( req.url ~ "^(cart|my-account/|checkout|addons|logout|lost-password|product/)" ) {

This isn't a problem, but it may make the usage clearer.


2) Between lines 67 and 130 you have many test cases on when to pass. Following that, you have a section that removes cookies, including WordPress cookies, with no conditions. But I do not see any VCL above line 130 that issues a pass based on the presence of a WordPress cookie.

It would help to see the varnishlog of what happens after the POST/login and the cached page, but one likely possibility is a page load that you aren't matching in lines 67-130 that is arriving without the proper cookies.

I would expect to see something like this before you start un-setting cookies around line 140

if (req.url ~ "^[^?]*\.(mp[34]|rar|tar|tgz|wav|zip|bz2|xz|7z|avi|mov|ogm|mpe?g|mk[av])(\?.*)?$") {
    unset req.http.Cookie;
    return (hash);
}

if ( req.http.Cookie ~ "wordpress_" ) {
    return (pass);
}

This type of action might allow you to short-cut much of the "COOKIE MADNESS" section by wrapping in a " if req.http.Cookie " check.

Cheers,
-=Mark

_______________________________________________
varnish-misc mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Reply via email to