Closed (works as designed)
Project:
Authenticated User Page Caching (Authcache)
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
5 Oct 2014 at 18:37 UTC
Updated:
16 Oct 2018 at 20:24 UTC
Jump to comment: Most recent
Comments
Comment #1
znerol commentedThanks for the report. Is this with Services module? If so please provide some more detail on your setup and also whether you are trying to cache authenticated responses delivered through services.
Comment #2
scotthooker commentedHi Znerol,
Its quite complicated to explain and to debug.
However, this is my setup
Drupal Services module is being used.
Service call to login via a remote app the call goes to index.php?q=service_endpoint/user/login.json
If I then logout and login the service resource will return an error due to an invalid CSRF token -
Inside this function is where the error is generated within services
The actual error is when checking drupal_valid_token($_SERVER['HTTP_X_CSRF_TOKEN'], 'services')
Works fine with authcache off. Broken with authcache on. And yes authcache is caching for all users. There seems to be no way to exclude this caching for this service callback.
Comment #3
znerol commentedNavigate to Administration » Configuration » System » Authcache Page Caching » Settings and add
service_endpointto the list of excluded pages. This should do the trick.Comment #4
scotthooker commentedTried that. Tried various combinations of that too
service_endpoint*
service_endpoint/*
The full end point path...
Had me thinking it could be the fact the service endpoints are called with non-clean urls. But looked through the authcache code and that should be handled ok.
Comment #5
scotthooker commentedMy hunch is that something is weird within
or
Comment #6
znerol commentedCan you break down your setup into a minimal sequence of steps I can follow in order to reproduce this issue (e.g. install drupal, enable authcache, enable services, set-up endpoint X, use
wget/curlwith parameters Y)? Alternatively, do you know of a tutorial/documentation page on how to set up services such that it roughly covers your use case?If you are comfortable with Features module, perhaps you can setup and export a minimum configuration as a feature?
Comment #7
znerol commenteddrupal_get_token()anddrupal_valid_token()are integral parts of the core security infrastructure. The main use is to protect against CSRF attacks. Although I do not yet understand why and how services is using them.Comment #8
scotthooker commentedHi Znerol,
Its quite specific I guess so you might not want to spend too much time looking into it. I just wanted to ask quickly to see if there was a quick solution.
Is basically what services is calling. It throws an error after I've logged in, logged out and am logging back in again as if its caching the wrong token. Or something is screwed with the sessions.
Comment #9
znerol commentedI played around with services a little bit and what I found is the following:
So if you are using JSON or something, authcache should not kick in at all.
Therefore I'm a bit out of ideas on what could go wrong here.
Which storage backend do you use? I.e., do you have Varnish running?
Comment #10
znerol commentedComment #11
scotthooker commentedAfter much debugging this was a services related issue.
Comment #12
tflanagan commented@scotthooker What was your fix for this issue?