getkirby / kirby

Kirby's core application folder
https://getkirby.com
Other
1.31k stars 168 forks source link

Page are cached after frontend login/logout #2544

Closed guidoferreyra closed 4 years ago

guidoferreyra commented 4 years ago

Describe the bug
After user login/logout some parts of the page that needs to change regarding the user login status doesn’t change. Like the page were cached. This only happens on live server, in localhost work as expected

To Reproduce
Steps to reproduce the behavior: I made a reduced test case using starterkit and this cookbook recipe

  1. Go to dev.tipografia.com.ar/usertest/ or download this testuser.zip and upload to server
  2. Click on Login and login with email: admin@admin.com pass: adminadmin
  3. Login item should change to logout and a secret text should appear on header. It doesn’t appears
  4. Reload page to see actualy see the changes.

In case after login it worked as expected click the logout button go home to see how the header didn’t get updated not displaying the text and showing the login button istead of logout. Some times its a little bit random, try to login/logout a few times.

Kirby Version
3.3.5

Desktop (please complete the following information):

Additional context
Only happens on real server not in localhost.

afbora commented 4 years ago

I don't think it's about Kirby. It seems to be caused by a cache driver on your server (maybe it could be Varnish cache). Because I had to click several times to logout and this is not normal.

Here your server response header and you'll see Cache-Control: max-age=600. This means it can give the same response from the cache for 600 seconds.

HTTP/1.1 200 OK
Date: Sat, 28 Mar 2020 07:50:35 GMT
Server: Apache
Upgrade: h2
Connection: Upgrade, Keep-Alive
Cache-Control: max-age=600
Expires: Sat, 28 Mar 2020 08:00:35 GMT
Vary: Accept-Encoding,User-Agent
Content-Length: 5975
Keep-Alive: timeout=2, max=100
Content-Type: text/html; charset=UTF-8
distantnative commented 4 years ago

Indeed, this sounds a lot like a server configuration issue.

guidoferreyra commented 4 years ago

Oh ok sorry, I thought it was a bug. Could you please give me a hint on how to solve this issue? Thanks in advance.

afbora commented 4 years ago

@guidoferreyra You can contact your hosting provider and ask them to disable or optimize the cache.

guidoferreyra commented 4 years ago

Thanks

afbora commented 4 years ago

You're welcome. Feel free to write again if you can't solve it.