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

form_key #6

Closed will-parsons closed 9 years ago

will-parsons commented 10 years ago

Unfortunately, the addition of form_key in Magento Community 1.8 will break 'add to cart' functionality when cached in Varnish.

Workarounds I've seen just seem to disable / bypass the form_keys entirely:

https://github.com/deivisonarthur/Inovarti_FixAddToCartMage18 https://bitbucket.org/supportdesk_nl/turpertine-formkey-workaround/src

Are there any plans to implement something similar?

Thanks!

maconeto commented 9 years ago

i second this. On my website when I enabled this module i can see a lot of <esi:include src= tag because ESI is not supported in community version of PageCache. They are not replaced by correct form key. If it is not supported, can you suggest how to disable ESI tag so I can apply other fix to it?

PHOENIX-MEDIA commented 9 years ago

We pushed a new release on Github that now supports form_keys. However you have to update your VCLs according to the README_VARNISH_CACHE.txt. Furthermore you need to adjust your Varnish startup parameters and add "-p esi_syntax=0x03" in order to parse the ESI tags properly.

Please note that ESI in the Github version is only supported to resolve the form_key issue. If you are looking for ESI support in other Magento blocks like the shopping cart please have a look at out PageCache powered by Varnish Enterprise version on Magento Connect.

maconeto commented 9 years ago

Thanks for responding. I already downloaded your newest realease of Pagecache module several days ago. I added -p esi_syntax=0x03 in startup parameters. What i don't understand is "update your VCLs". I used these ones:

PHOENIX-MEDIA commented 9 years ago

Please check the latest commit which should solve the issue.

gibbs commented 9 years ago

I am having an issue with this. The changes work but the form key is not being included. The request works:

Request Method:GET
Status Code:760 lAprIeHezAj4M0q9

But the output is always empty:

<input name="form_key" type="hidden" value="" />
PHOENIX-MEDIA commented 9 years ago

Have you added "-p esi_syntax=0x03" as Varnish startup parameter?

gibbs commented 9 years ago

Hi. Yes - it looks like this:

DAEMON_OPTS="-a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_LISTEN_PORT} \
             -f ${VARNISH_VCL_CONF} \
             -T ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} \
             -t ${VARNISH_TTL} \
             -S ${VARNISH_SECRET_FILE} \
             -s ${VARNISH_STORAGE} \
             -p esi_syntax=0x03 \
             -p shm_reclen=4096 \
             -w ${VARNISH_MIN_THREADS},${VARNISH_MAX_THREADS},${VARNISH_THREAD_TIMEOUT}"

Otherwise the ESI markup should be returned.

PHOENIX-MEDIA commented 9 years ago

This is strange. Please post a URL where we can check it or write an email to support@phoenix-media.eu. Thanks.

gibbs commented 9 years ago

Here's an example on a development domain with full headers being returned and multiple forms: http://cc.gcmdev.co.uk/head-gear/nrs-havoc-helmet

PHOENIX-MEDIA commented 9 years ago

Compare the output here: http://magento.phoenix-media.eu/varnishcache/getformkey/

Seems smth is wrong with your VCL setup or Varnish.

Please note that this module is provided "as is". If you need support please subscribe to the Enterprise version of our module http://www.magentocommerce.com/magento-connect/pagecache-powered-by-varnish.html.

gabrielqs commented 9 years ago

Hi,

Will updating the vcl break magento stores running with old module versions?

Thanks, Gabriel

PHOENIX-MEDIA commented 9 years ago

No, the changes are backwards compatible.

deivisonarthur commented 9 years ago

Hello friend if you still have the error try swapping by esi_syntax -p = 0x2 \ worked here

www.inovarti.com.br

gabrielqs commented 9 years ago

Thanks!

kneedrag1 commented 9 years ago

Still having the same issue, I think, as others reported. Latest Git pull. Magento 1.9.0.1

From varnishtop: 23.11 Debug VCL_error(760, vPTgifwSf7IHFpmK) 23.11 VCL_return error 23.11 Hash /varnishcache/getformkey/ 23.11 VCL_call error