0

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 http://127.0.0.1:8080/workspace/mage233data/olivia-1-4-zip-light-jacket.html" the issue is not fixed enter image description here

My custom form code added to the product detailed page

<body>
        <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>
                        <action method="setImgWidth">
                            <argument name="width" xsi:type="string">230</argument>
                        </action>
                        <action method="setImgHeight">
                            <argument name="width" xsi:type="string">50</argument>
                        </action>
                    </block>
                </container>

                <arguments>
                    <argument translate="true" name="title" xsi:type="string">Question And Answer</argument>
                </arguments>
                <block class="Magesen\ProductQA\Block\Product\View\AnswersList" name="answerslist"
           template="product/view/answerslist.phtml"/>
          </block>
        </referenceBlock>

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

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.

0

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.

| improve this answer | |
  • do you have any solution to avoid the Set-Cookie in Product detailed page while loading my custom form – senthil Apr 16 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. – Thijs Feryn Apr 17 at 6:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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