0

I have a simple website running Magento CE 1.9 on a single Linux/Apache server. The website works ok with HTTP but I am having a lot of issues trying to get HTTPS working.

After setting the Unsecure and Secure Base URLS to https:// and saving the config, I immediately get logged out of the Admin console and get a ERR_TOO_MANY_REDIRECTS error. I have looked at and tried other similar posts people have made but nothing seems to fix it.

Current Magento settings:

AUTO REDIRCECT TO BASE URL = NO

USE WEB SERVER REWRITES = YES

USE SECURE URLS IN FRONTEND = YES

USE SECURE URLS IN ADMIN = YES

OFFLOADER HEADER = SSL OFFLOADED

I am not an experienced Magento or Web guy, so appreciate any guidance.

Thanks

6
  • What did you setup your full url? You may have forgotten this sign / at the end. Jul 6, 2017 at 23:27
  • Have you checked using curl on the command line to make sure it's not just a browser cached redirect? curl -I https://www.nicks-website.com/ Check for a 302 or a 200. Jul 6, 2017 at 23:39
  • Thanks Danny I ran two checks and both returned 302. I cleared all browser cache and magento cache and session logs also. Problem still persists
    – Nick Hoare
    Jul 7, 2017 at 5:59
  • Hi Adarsh, yes I used a / at end of each url. Can confirm web/unsecure/base_url and web/secure/base_url both equal https://nicks-website.com/
    – Nick Hoare
    Jul 7, 2017 at 6:08
  • Also for reference, this is what my HTACCESS file looks like. <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>
    – Nick Hoare
    Jul 7, 2017 at 6:21

4 Answers 4

6

Just to close this out, a good friend of mine suggested I try this, and I am very pleased to say it worked. Perhaps it will help someone else who faces the same issue: In .htaccess file, add these lines:

# Detect the ELB header and set the header magento expects SetEnvIf X-Forwarded-Proto https HTTPS=on

1
  • this solved my problem with magento 2 while using content delivery network. Sep 24, 2019 at 0:26
3
  1. Check if your https is properly configured, eg. here https://www.sslshopper.com/ssl-checker.html
  2. Clean Magento cache.
  3. Clean your browser cache and Magento domain cookies. Try it on "private" browsing mode.
  4. Create test.php file in your main Magento directory.

<?php phpinfo();

Run https://[domain]/test.php and Ctrl+f for "HTTPS". Sometimes your server is hidden behind load balancer and there is no $_SERVER['HTTPS'] system variable. The fastest workaround is to add this line on the top of your index.php file:

$_SERVER['HTTPS'] = 'on';

0

You could try: Backup your database and run the installation of your Magento 1.9.x.x again (use the exact same version to avoid bugs). Fill in both url's (non-secure and secure) with the https:// link. Now all links in your installation will be changed to https.

Or: You could also export your database with Phpmyadmin (note: "disable foreign keycheck" in phpmyadmin), change all http:// to https://, and import again (note: "disable foreign keycheck" again in phpmyadmin).

And clear your browser cache.

If it doesn't work, check your installation with the default .htaccess file to check wether there are redirect errors in it.

0

The below command works for me. I have nginx ingress controller in the front and apache-magento container in the backend. Just set it in the .htaccess of the magento root directory.

Detect the ELB header and set the header magento expects

SetEnvIf X-Forwarded-Proto https HTTPS=on

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.