How do I prevent caching of /login_form by Varnish in front of Plone

203 views Asked by At

On my Plone site, when a user goes to a particular page P, then clicks "login" and completes the login procedure successfully, she's redirected to the homepage or a random page, instead of to page P.

I think this is because the page /login_form is served from the Varnish cache and contains the hidden came_from field from some other user when it was cached: .

What's a good way to prevent caching of /login_form, and perhaps of other pages with the same mechanism?

Shouldn't the Cache Configuration Tool (CacheFu/CacheSetup) take care of this and send headers with /login_form to prevent caching?

I couldn't find any information regarding this problem in Plone's documentation on Varnish.

I'm using Plone 3.3.5 with the Cache Configuration Tool (CacheSetup 1.2.1), and Varnish 3.0.2 in front (Client < Apache < Varnish < Plone) on Debian Linux 7.6.

2

There are 2 answers

0
Ketola On

Not being familiar with Plone I cannot comment on the configuration in Plone's end. But to prevent /login_form URLs from being cached, you could use the following vcl_recv()

sub vcl_recv {
  if (req.url == "/login_form") {
    return(pass);
  }
}
0
Dek4nice On

There is helpfull varnish conf, use it - http://docs.plone.org/manage/deploying/caching/varnish.html#varnish-3-x-example

ps: line of code with enabled authorization:

if (req.http.Authorization || req.http.Cookie) {return (pass);}