magento-turpentine icon indicating copy to clipboard operation
magento-turpentine copied to clipboard

302 Redirect when using Googlebot Agent

Open csdougliss opened this issue 6 years ago • 5 comments

http://www.redirect-checker.org/index.php

Checking our site as a user, no 302 re-direct Checking our site using GOOGLEBOT, 302 re-direct.

The only option we have found is to set Validate HTTP_USER_AGENT" to "No" which is a security related feature of Magento we would rather not switch off.

This prevents the 302 re-direct.

Any suggestions?

Same issue here: https://github.com/nexcess/magento-turpentine/issues/881

csdougliss avatar Oct 05 '18 09:10 csdougliss

Can confirm this issue does not appear when varnish/turpentine is not used on a separate magento site.

csdougliss avatar Oct 09 '18 10:10 csdougliss

Here is my work around if anyone else needs it:

app/code/local/Mage/Core/Model/Session/Abstract/Varien.php (copied from app/code/core) around line 473:

protected function _validate()
        if ($this->useValidateHttpUserAgent()
            && $sessionData[self::VALIDATOR_HTTP_USER_AGENT_KEY] !=                                     
           $validatorData[self::VALIDATOR_HTTP_USER_AGENT_KEY]
        ) {

// don't verify if crawler agent
            // e.g. Googlebot/2.1 (+http://www.googlebot.com/bot.html)
            $turpentineCrawlerAgents = Mage::helper('turpentine/data')->cleanExplode(',',
                    Mage::getStoreConfig(
                        'turpentine_vcl/backend/crawler_user_agents' ));
            if($turpentineCrawlerAgents && is_array($turpentineCrawlerAgents)) {
                foreach ($turpentineCrawlerAgents as $agent) {
                    if (preg_match('/' . $agent . '/iu', $validatorData[self::VALIDATOR_HTTP_USER_AGENT_KEY])) {
                        return true;
                    }
                }
            }

csdougliss avatar Oct 11 '18 09:10 csdougliss

We have the same issue in one of our shops. Environment: nginx (https) -> varnish (4.1) -> apache2 (php5-fpm) Magento 1.9.x, Turpenine 0.7.4

Setting "HTTP_USER_AGENT" to "NO" doesn't help, neither does adding the above code to Varien.php.

Still searching.

axmue avatar Oct 25 '18 11:10 axmue

I'm still facing this issue on my magento 2 site https://rootedobjects.com. Has anyone found a solution?

knambiar avatar May 27 '19 19:05 knambiar

@knambiar your issue is unrelated to Turpentine if you are having it on a Magento 2 site. The Turpentine module does not work with Magento 2.

ChrisOrlando avatar May 28 '19 00:05 ChrisOrlando