PHOENIX-MEDIA / Magento-PageCache-powered-by-Varnish

Community version which is available on Magento Connect (http://www.magentocommerce.com/magento-connect/pagecache-powered-by-varnish.html)
89 stars 49 forks source link

Checkout Form Key Issue #17

Closed robsonlopes closed 8 years ago

robsonlopes commented 9 years ago

I have strange problem at checkout and in the client area, see the screenshot http://screencast.com/t/pgbth6ez4jF

<input name="form_key" type="hidden" value="<esi:include src=" http:="" virtualfashion.com.br="" varnishcache="" getformkey="" "="">

johnjyin commented 9 years ago

yes, this also happened on my Magento v1.9.0.1 site (with Varnish 4.0)

I also tried Varnish_Cache-4.2.2, it looks like nothing help.

I tried all tips mentioned in README_VARNISH_CACHE.txt, but the issue is still over-there.

1230 varnish error-form_keys

ihor-sviziev commented 9 years ago

@johnjyin I see that now you fixed this issue. Looks like you added "-p esi_syntax=0x03" to startup parameters.

But after that I got next issue - when I go to some product page which contain formkey - it try replace

<esi:include .../>

to current page content (see screenshot below). image

Could anyone help me fix it? PS:Varnish cache 3.0.5

hugodiasneto commented 9 years ago

Same problem here :(

ihor-sviziev commented 9 years ago

@hugodiasneto you have same issue like me or like guy from first post? If same like guy from first post - try add "-p esi_syntax=0x03" to startup parameters

matthiaskomarek commented 9 years ago

@ihor-sviziev i got the same problem. do you have solved this issue?

ihor-sviziev commented 9 years ago

@matthiaskomarek no, now we using older version of this module and implemented hack for skipping form key validation, but it can be unsecure.

KevinMace commented 9 years ago

I have the same issue with the ESI include tag displaying on the frontend. I ended up doing the same as @ihor-sviziev by using the older version which does not use ESI, then added a 'hack' to remove form key validation.

Cranke commented 9 years ago

This is due to bad quoting.

change lines 24 and 25 of app/code/community/Phoenix/VarnishCache/Helper/Esi.php

from

const ESI_INCLUDE_OPEN  = '<esi:include src="';
const ESI_INCLUDE_CLOSE = '" />';

to

const ESI_INCLUDE_OPEN  = "<esi:include src='";
const ESI_INCLUDE_CLOSE = "' />";
chougron commented 9 years ago

I fixed this by adding "-p esi_syntax=0x03" to my startup parameters (as said in the README) then, editing the given .vcl file as accordingly :

Search for “sub vcl_fetch {“ And add just below : set beresp.do_esi = true;

Then I restarted varnish service, flushed varnish cache in Magento settings, cleaned the cookies.

ihor-sviziev commented 9 years ago

@Cranke or @chougron could you create pull request which will fix those issue?

Cranke commented 9 years ago

done

ihor-sviziev commented 9 years ago

@PHOENIX-MEDIA could you merge those changes?

jonathonbyrdziak commented 9 years ago

@Cranke I've confirmed that this was the issue with my install @ http://residualdrivers.com Thanks for that fix!

djgoulaer commented 9 years ago

@Cranke Hello friends! I was very pleased to see everyone's efforts to solve this annoying problem.

The solution mentioned above was excellent, but not fully resolved the issue. As you can see from the images below, an error occurred in the javascript code that creates the cockie PAGECACHE_FORMKEY. Does this error has to do with the other?

I auditioned on a clean installation of Magento 1.9.1.1

capturar capturar1

Cranke commented 9 years ago

ok we can change that, too. in app/design/frontend/base/default/template/varnishcache/cookie/formkey.phtml change line 36 from

'<?php echo $_formKeyValue; ?>',

to

 "<?php echo $_formKeyValue; ?>",

clear caches and the code will work.

djgoulaer commented 9 years ago

@Cranke Thank you!