I try to install magento 2.0.1 on cloud9 (c9.io) but keep getting a redirect loop when calling the admin site.

http://mage2-lptt.c9users.io/admin_1a798x/ same with https.

The Log only shows:

[Thu Jan 28 09:24:14 2016] [302]: /admin_1a798x/
[Thu Jan 28 09:24:15 2016] [302]: /admin_1a798x/admin/index/index/key/1e30bc5f51f9e34b0a6234eaef2e20b03618a98c119c8ca17875e3977b929de2/ [Thu Jan 28 09:24:15 2016] [302]: /admin_1a798x/admin/index/index/key/1e30bc5f51f9e34b0a6234eaef2e20b03618a98c119c8ca17875e3977b929de2/


Any ideas how to resolve this?

  • what kind of server do you have? apache or nginx?
    – Maddy
    Commented Feb 3, 2016 at 16:57

2 Answers 2


If running Apache add these lines to .htaccess


SetEnvIf X-Forwarded-Proto https HTTPS=on

  • 1
    I confirm this is fixing the issue on Magento 1.
    – Fra
    Commented Jun 1, 2016 at 17:05

The fix is very easy, you just need to add the port to your base url.

In your specific case you have to set it to: http://mage2-lptt.c9users.io:80/

This won't affect browsing the website, as it's an issue related to port forwarding on Cloud 9. The Apache instance on your container will receive a request with the port in it even if the browser is not aware of that.

If you want to dig deeper, you can verify that the redirect loop is caused by a condition on line 44 of Magento\Backend\Controller\Adminhtml\Auth\Login.

  • This works for Magento 2. Had to set the port to 443 for the secure base url too. Commented Oct 23, 2016 at 12:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.