Magento Varnish Cached blocks visible for logged in users - magento

My clients Magento-site is hosted on SiteGround with SuperCacher activated. SuperCacher is a SiteGround optimized version of Varnish.
It uses a version of Turpentine for Varnish caching.
I've got at Search block that is only visible to logged in users.
This block won't show up when Varnish is activated.
When I specify af ESI policy with ttl 0 for the Search block, it becomes visible but for both logged in and logged out users.
How do I leave this block out of the cache and only show up for logged in users?

this link is very useful to me in this link explanation for how to remove block from cache Magento Hole puch With Varnish Hope this will also helpful to you.

Related

Login error not working on Magento 1.9.2.4

I created a website here - http://sdl2.alphalogichq.com/index.php/customer/account/login/
When I enter any email, for ex. abc#xyz.com and password - pass123 (both of them are wrong), it should ideally give me error Invalid login or password.
But here it just loads from cache and doesn't show the error. I need to force reload (CTRL + F5), and then it shows the error.
How can I change the behavior so it works properly?
I found X-Cache, X-Cache-Hits and X-Cacheable in response header that shows you are using some kind of caching. This is caching is implemented in server not by magento. I think this is Varnish cache as i found X-Varnish response header.
Cache HIT occurs when page load normally and cache miss occurs when you reload when load with CTRL+F5.
To resolve this issue ask your web hosting provide to disable Varnish cache. And i suggest you to use magento's cache and you can use Lesti FPC which is better to optimize website.

Magento cache issue in multi store

I have multi store set up in Magneto extension,during development phase I disabled cache but now my development is over and I want to enable cache to increase the performance of my site.But as I enabled cache from Admin my website show abnormal behavior i.e.,show blank screen in Admin and in front end or not showing product in category page.This is the two case I found as i Enabled cache.
Please tell me how to enable cache without disturb my all site.
Above issue is solve by:-
You may be using an alternative cache backend, in such case, using the Flush Cache Storage button should be sufficient to empty the cache contents and then enable cache of "Blocks HTML output".
Your cache blocks might not be have a store ID as a key element.
This might result in cache getting shared and resulting in wrong blocks being displayed.

Magento Onepagechekout login issue when using Varnish

I'm using:
Magento v1.7.0.2,
Varnish cache v3.0.3 and
One Page Checkout (OPC) module from IWD (v2.0.9)
I've added routes "onepagecheckout" and "onestepcheckout" to routes which should be excluded from the cache in Varnish.
I can see that OPC page is not loaded from Varnish and works as it should, however, when the quick login form is used on OPC page, it doesn't work properly together with Varnish.
Even when all cache items (including Varnish full page cache) have been disabled in Magento Cache Management.
What I get is the following response from /onepagecheckout/index/login/ script:
{"success":true,"redirect":"http:\/\/myhost.com\/onepagecheckout\/index\/index\/"}
the page get's redirected to the shopping cart but I'm still not logged in.
When switching Varnish off, it works just fine.
Does anybody has some experience with this?
Many thanks in advance!
Finally solved the issue by adding the following lines to Varnish's VCL file:
if (req.url ~ "^/(index.php/)?(checkout|onepagecheckout)")
{
return(pipe);
}
although, these two routes were already added to "Routes to exclude from cache" in MADE configuration (seems that having them in the exception list) leads to simple return(pass) in the background.
It is important to use return(pipe); instead of return(pass); to pass all the cookies to client.

Magento User Sessions Being Mixed Up

I was wondering if anyone could help me with the following issue. On our Magento site, enterprise version 1.10.1.1, a user may log in, and it will say another person's name. Then, if you click on another link, it might go back to your name. The user sessions are clearly being confused. Apparently, this is a full-page caching problem, because our full page cache is often invalidated and, if we turn it off, the user sessions no longer mix up. However, turning it off considerably slows down the site. Switching the sessions from db storage to file storage (and vice versa) did not fix the issue. Does anyone know what the problem could be or how to solve it?
Thanks very much,
Brenda
You should check with Magento for a patch. I had a similar problem with Gift Certificate field info getting mixed up between sessions. They provided a patch that resolved the problem.
In the header.phtml file you should use this to print the user name
<?php echo $this->getChildHtml('welcome') ?>
Then, you can override the block 'Mage_Page_Block_Html_Welcome' if you wanna customize your message.
this happens when you use "Full Page Cache" because by default, magento exclude some blocks of the full page cache, and the block 'welcome' is one of they. if you are using customization code and message, the user name will be cached too, and other users will see different user names in this section.
it can be dependence on the cache issue. Try to turn cache off (go to admin, system, cache management and disable all cache).
If issue gone - you need to check cache configuration. If not - you have really session issue.
BTW, where you store sessions (files or DB or memcached?)
I found the cause related to Enterprise_PageCache_Model_Processor_Default class, my way is disable it in config.xml, edit src\app\code\core\Enterprise\PageCache\etc\config.xml:
<requests>
<!-- <cms>enterprise_pagecache/processor_default</cms>-->
</requests>
This problem was probably caused by Magento not being able to set proper session parameters if it was behind a reverse proxy cache like Varnish (I bet it was the case). Whenever using an intermediate caché system you have to make sure you are using the apropiate module in Apache to forward the X_FORWARDED_FOR http header to Magento like mod_rpaf, otherwise Magento will see al requests coming from the same IP and it will not be able to determine correct session isolation as it will think all requests come from the same client.

Magento session lost when switching to https from http

I've searched high and low for a solution to this, with no luck. My host told me they are too busy to help.
Magento 1.4.2 // SSL cert
1- When I add an item to cart, the page reloads and my item is added to cart. [good]
2- Next, I click home, and my items are no longer visible in cart sidebar. [bad]
3- Next, I click "Tops", and my items are still not visible in cart sidebar. [bad]
4- Next , I click "Bottoms" and the items show just fine.
In all cases where the cart isn't visible, I can add https to the URL and the cart loads up just fine. Can anyone help me figure out why my session is being lost between http and https?
I have all my backend web cookie settings set to "no" except for sID.
Also- When a user is logged in, the cart items ALWAYS show on the right. It's only screwy if they're a guest.
Thanks guys, if you need me to post any code let me know.
wwwdotlylifdotcom
EDIT: Here is a screenshot of my cookies session in firebug (not exactly sure what I am looking at). Hope this helps.
And here is my Session settings in magento: I have tried just about every variation of turning these on and off.
EDIT!
This issue has actually been narrowed down to a cache issue. We found out that when the cache is dumped/deleted, the website works properly. But after a few minutes of surfing the problem happens again. Does anyone have any idea? (And should i change the question title?)
I'm using a module called Lightspeed from TinyBrick, and it seems the new cache options are messing with our site. =( I'm contacting them shortly.
**EDIT Tinybricks excellent support helped us out. Thanks for all of your suggestions.
Is the session cookie being set to be HTTPS-only? That'll prevent it from being carried over to regular HTTP requests, effectively giving the user two different sessions.
You have in your screenshot two frontend cookie with two domains, one with www and an other one without. Check if you have a correct domain name in the configuration > Web tab > Cookie Management > Cookie Domain (or something close to that). If it's empty set it to ".mydomain.com" and try again.
Check if you don't have different cookie domain in your configuration in the other store views, set them to "use website".
If still doesn't work, What are the values of the fields of cookie management and the cookie validation settings
We were experiencing similar issues where our custom nav (depending on whether a user was logged in or not, was not very consistent across different pages.
We followed the suggestion # http://ka.lpe.sh/2011/06/19/magento-checking-customer-admin-is-logged-in-or-not/ to check if a user was logged base on the frontend session variable before a rendering a particular block, and it seems to have done the trick.
Perhaps you can try something similar.
Tinybricks excellent support helped us out. Thanks for all of your suggestions. This was a localized problem based off cache and a module called Lightspeed.

Resources