Magento2: Frontend base url https results in admin too many redirects

Created on 6 Mar 2017  路  9Comments  路  Source: magento/magento2

Preconditions

  1. Magento 2.1.4
  2. PHP7

Steps to reproduce

  1. Setup Magento to use a different url for admin through " admin/url/custom" configuration and make this url use http not https.
  2. Set the unsecure base url in your default configuration to https (so the whole website will be using https)
  3. Now you can't get into the back-end of magento anymore because of too many redirects.

Expected result

  1. Everything should still work correctly, front-end should be entirely using https and back-end should use http.

Actual result

  1. You get a server error with too many redirects.

Comments

I did some debugging on this issue and after some time I see that in function "shouldBeSecure" in class "Magento\Backend\Model\AdminPathConfig" is checking whether the default url configured is using https. While it should check whether the store with id 0 is using https if the custom admin url setting is used.

Fixed in 2.2.x Fixed in 2.3.x Confirmed Format is valid Ready for Work Reproduced on 2.1.x Reproduced on 2.2.x Reproduced on 2.3.x

Most helpful comment

Has there been a fix to this as yet?

All 9 comments

If I had to guess I'd say you weren't setting an environmental variable that indicates the connection is secure (ie Apache's HTTPS=on). Magento is probably checking for that somewhere in the code and then redirecting to the same https URL as the check repeatedly fails. If you have a virtual host or enabled site on port 443, make sure you set that env variable.

I get same this problem when try to using custom admin URL. Front-end is work good but back-end gets the redirect loop error.

@bartlubbersen, thank you for your report.
We've created internal ticket(s) MAGETWO-83474 to track progress on the issue.

Has there been a fix to this as yet?

Any updates on this issue?

Any resolution yet?

Any update on this ?

Hi @bartlubbersen.

Thank you for your report and collaboration!

The issue was fixed by Magento team. The fix was delivered into magento/magento2:2.2-develop branch(es).
Related commit(s):

The fix will be available with the upcoming 2.2.10 release.

Hi @bartlubbersen.

Thank you for your report and collaboration!

The issue was fixed by Magento team.

The fix will be available with the upcoming 2.3.3 release.

Was this page helpful?
0 / 5 - 0 ratings