Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

302 Redirect when using Googlebot Agent #1515

Open
csdougliss opened this issue Oct 5, 2018 · 5 comments
Open

302 Redirect when using Googlebot Agent #1515

csdougliss opened this issue Oct 5, 2018 · 5 comments

Comments

@csdougliss
Copy link
Contributor

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: #881

@csdougliss
Copy link
Contributor Author

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

@csdougliss
Copy link
Contributor Author

csdougliss commented Oct 11, 2018

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;
                    }
                }
            }

@axmue
Copy link

axmue commented Oct 25, 2018

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.

@miguelbalparda miguelbalparda added old-invalid Issues created before 2018-01-01. Will close en mass on Feb 15. and removed old-invalid Issues created before 2018-01-01. Will close en mass on Feb 15. labels Feb 6, 2019
@knambiar
Copy link

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

@ChrisOrlando
Copy link
Collaborator

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants