Letting anonymous users vote in a poll when using Varnish I have a poll on my front page that I want users to be able to vote on, but anonymous users always just see the results and are never able to vote. I've been trying just about everything I can think of to fix this and nothing works.

I'll start by saying that I can access my web server directly through an alternate port. When I do this I see the poll when I'm not logged in; so I know that anonymous users can vote.

I've tried using ESI and the Drupal 7 ESI module. I got it set up and working so that the poll block is being loaded via an ESI tag (obviously accessing it directly through the alternate port stopped working when I did this since browsers don't parse ESI tags). No dice.

I tried using the AJAX Blocks module, I set a delay on loading the block just so I could visibly make sure the block was loading via AJAX, it was and it was still just displaying the results.

I tried voting from the same IP address using the alternate port, thinking that since someone has voted going through Varnish before the server wont allow it again, but I can vote twice from the same IP address through the alternate port.

I tried logging into the server via ssh and using Links to view the site, thinking that maybe it's the local IP address that is making the web server serve the results page for some other reason, but when I use Links I can see the voting form.

Clearly there's something that's causing Drupal to serve the results instead of the form when Varnish requests the page, but what is it?!?
https://drupal.org/project/pollanon
This lets anonymous users vote in a poll more than once, and here's an article on using ESI to allow parts of your page to remain cached while other parts remain dynamic.

Accepting votes from anonymous users on Drupal polls is complicated when you use caching. By using Edge Side Includes (ESI), you can dynamically load some parts of a Drupal page while caching the rest of it. The addition of the Poll Enhancements module allows multiple anonymous users to vote on polls by using cookies to track who has voted.

Edge Side Includes integration
The ESI module includes two Varnish VCL files (located in the docs directory of the module:

docs/esi_blocks.vcl - custom sub-routines to handle ESI-block integration.
Copy this file to the Varnish config directory, /usr/local/etc/varnish/
docs/default.vcl - example code showing how to include the ESI blocks VCL in your Varnish config. Portions of this should be added to appropriate places your Varnish config file. We'll do it by creating a copy, /usr/local/etc/varnish/default-esi.vcl, that has the portions we want:
include "/usr/local/etc/varnish/esi_blocks.vcl";
sub vcl_recv {
  call esi_block__recv;
}

sub vcl_hash {
  call esi_block__hash;
}

sub vcl_fetch {
  # don't ESI anything with a 3/4 letter extension
  # (e.g. don't try to ESI images, css, etc).
  if (! req.url ~ "\..{3,4}$") {
    esi;
  }

  call esi_block__fetch;
}

Then, edit /usr/local/etc/varnish/drupal.vcl and add a line near the beginning:

include "/usr/local/etc/varnish/default-esi.vcl";
Restart the Varnishcache:

svc -t /service/varnish
With the module enabled in your Drupal site, block configuration pages now have an ESI Settings section with two options: Enable ESI, and a TTL value.

Poll Enhancements
Installing this module allows anonymous users to vote on polls. By using cookies to track who has voted, multiple users who are behind a firewall will be able vote on polls. There's a threshold setting for how many votes from a single IP in a time period. The module also provides a Use AJAH option - I needed to enable this to have the ESI-enabled Poll block work properly.

Configure Varnish to ignore the poll cookie ( pa-[nid] ) by editing the vcl_recv section of /usr/local/etc/varnish/drupal.vcl and inserting a line to remove the cookie:

// Remove pollanon cookies.
set req.http.Cookie = regsuball(req.http.Cookie, "(^|;\s*)(pa(.*))=[^;]*", "");
Restart Varnish:

svc -t /service/varnish


Source: http://www.productionmonkeys.net/guides/drupal/performance/pressflow/varnish/varnishing-polls