Since I switch my website to varnish, token are not working anymore.
Any idea ?

Comments

Brian294’s picture

Assigned: Unassigned » Brian294
Category: bug » support
Status: Active » Closed (won't fix)

Thank you for reporting this issue.

I have limited understanding of Varnish, but it's my understanding that it's a reverse proxy. It is intercepting page requests and servicing them from cache. This mechanism completely bypasses the execution of PHP/Drupal code, therefore causing the tokens to not be created. I am not an expert in Varnish, but I would recommend you look at the possibility of adding URL exceptions to the reverse proxy (such as the URL of the form and form processing script).

Peace,
Brian

vacilando’s picture

I am using Pressflow with Varnish and it is easy to get the correct IP address simply by using ip_address() instead of $_SERVER['REMOTE_ADDR']. See http://api.drupal.org/api/drupal/includes--bootstrap.inc/function/ip_add...

vacilando’s picture

Status: Closed (won't fix) » Active

I think it should be possible despite the use of Varnish; see #2.

Brian294’s picture

Status: Active » Postponed (maintainer needs more info)

Varnish only returns static HTML and doesn't execute the PHP on each page load. How can this work without the PHP executing? The PHP code is where all of the cookie logic resides.

greggles’s picture

Status: Postponed (maintainer needs more info) » Active

@Brian294 - I think you're right that you need to set Varnish not to cache these pages AND use ip_address in order to get the real IP address.

Basically it's never appropriate to use $_SERVER['REMOTE_ADDR'] directly and Drupal modules should always call ip_address().

Brian294’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)