I've created some Magento2 Extension, I've uploaded those code into the Magento2 Market place. In that market place, there has some kind of code validation procedure, and I've written my code as per the Market place policy.

After the marketplace team tested my code, they have raised some test reports. I've attached the report screen for your further reference.

enter image description here

As per the test report, I've Installed the varnish cache and tested the module to adaptable for the varnish So that I've followed the below link to accomplish that into my local.

Magento 2 : Expected HIT on the second page load after product price update

X-Magento-Cache-Debug: MISS

Even If I test the varnish cache using this command "curl -I" the issue is not fixed enter image description here

My custom form code added to the product detailed page

        <referenceBlock name="product.info.details">
            <block class="Magesen\ProductQA\Block\Product\View\AskQuestion" ifconfig="productqa_tab/productqa_setting/productqa_active" name="product.question" template="product/view/ask_question.phtml" group="detailed_info" cacheable="false">
                <container name="form.additional.info" label="Form Additional Info">
                    <block class="Magento\Captcha\Block\Captcha" name="captcha" after="-" cacheable="false">
                        <action method="setFormId">
                            <argument name="formId" xsi:type="string">product_qa</argument>
                        <action method="setImgWidth">
                            <argument name="width" xsi:type="string">230</argument>
                        <action method="setImgHeight">
                            <argument name="width" xsi:type="string">50</argument>

                    <argument translate="true" name="title" xsi:type="string">Question And Answer</argument>
                <block class="Magesen\ProductQA\Block\Product\View\AnswersList" name="answerslist"

          <referenceBlock name="head.components">
            <block class="Magento\Framework\View\Element\Js\Components" name="captcha_page_head_components" template="Magento_Captcha::js/components.phtml"/>

I've removed the "cacheable="false" from the below XML also, but still, I am facing the problem.

I am looking forward to some help from your end to fix the problem.

My Extension short view:

In my custom module customer can able ask a question from the product detailed page. Then the admin reviews the question and reply to that question & can make it visible.

1 Answer 1


When I inspect your HTTP output, I'm seeing a Set-Cookie appear. It sets the PHPSESSID.

If Varnish sees an incoming Set-Cookie, it will not cache the object, because setting a cookie implies a state change.

The question you have to ask yourself: does it make sense to set the cookie at that point? Or should the PHPSESSID already be set at this point?

Please also check whether or not the cookie is set again the 2nd time you call the page.

  • do you have any solution to avoid the Set-Cookie in Product detailed page while loading my custom form
    – senthil
    Apr 16, 2020 at 5:15
  • The only thing I can say: try to figure out which component triggers the set-cookie, and try to get rid of it if you believe it adds no value. There are too many scripts out there that perform a session_start() in PHP for the sake of starting a session. If you have no real reason to initialize a session, don't. The impact on caching is quite big. Once you've gotten rid of unwanted set-cookie headers being set, we can evaluate if the situation has improved. Apr 17, 2020 at 6:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.