Varnish + Rails causes invalid authenticity tokens in development
-
25-09-2019 - |
Question
Here is my situation. I am testing out Varnish on my local box (I'm doing some stuff related to page caching that would be a big pain to push to staging every time). Everything works fine, except whenever I submit a form, I get an ActionController::InvalidAuthenticityToken
exception.
Varnish is running on localhost at port 6081, and Thin is running on localhost at port 80. I get the exception when I try to use the site using port 6081.
Is there any way I can get around this?
Solution
Okay, so the reason this was failing was my VCL file was clearing out all cookies on every request. Obviously, this would cause some issues with the authenticity token.
Silly fix for a silly problem :/
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow