1

I am trying to migrate a magento version 2.3.3 site / system from one server to another.

After doing everything I should do to complete the migration I am getting 302 as a server response once after another. A targeting loop.

I have already tried some solutions such as changing the values of the config table core_config_data.

            path           |              value
    web/seo/use_rewrites   |                1
    web/unsecure/base_url  |       http://exemple.com/
     web/secure/base_url   |      https://exemple.com/
web/secure/use_in_frontend |                1
web/secure/use_in_adminhtml|                1
  web/url/redirect_to_base |                0
   web/cookie/cookie_path  |               NULL
  web/cookie/cookie_domain |               NULL
 web/cookie/cookie_httponly|                0

I looked into .htaccess to see if there was something that was redirecting and found nothing either. I leave the link to it here: https://pastebin.com/30LDUsb5

After thinking it was all right, I ran php bin / magento c: c. And perhaps another important piece of information, magento is using Redis for front and backend sessions and caching. The server I set up has a Redis server available but it is empty, magento can populate it from scratch.

Thank you in advance for any light.

3

Explanation:

Your frontend is using http, but in your config you've set it to force https in frontend (web/secure/use_in_frontend value 1, meaning "yes/true"). Therefore by visiting https, magento2 redirects to http, but the http reads the m2 config and goes back to https. Hence the loop.

Solution 1:

Try setting web/secure/use_in_frontend to 0

php bin/magento config:set web/secure/use_in_frontend 0

and clear the cache:

php bin/magento cache:clean

Confirm the changes:

php bin/magento config:show web

Solution 2:

Another way to resolve this is to set your web/unsecure/base_url from http to https.

If the redirect still persists with use_in_frontend as 0, try in a new private/incognito window or clear your cache and try again, or even another PC/mobile or a different network (your mobile 3G), as redirects sometimes persist and need clearing local system dns caches etc.

4
  • Hi @SavvasRadevic i try both solutions and not works. Now secure and unsecure have https. I try without https in both but no success. – Matheus Prado Dec 24 '19 at 10:48
  • 1
    I clean cache, and flush dns. Open website in private mode not works. – Matheus Prado Dec 24 '19 at 10:50
  • 1
    @MatheusPrado I see it helped you after all? Which solution did the trick or what extra steps did you take to fix it? – Savvas Radevic Jan 5 '20 at 14:40
  • 2
    Yes i fix it using your answer. – Matheus Prado Jan 8 '20 at 10:39
0

Insert "SetEnvIf X-Forwarded-Proto https HTTPS=on" to .htaccess

New contributor
Pornpasok Sookyen is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

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.