I have a question regarding a redirect (302) that happens when accessing the /admin panel of my Craft CMS application.

I've setup CloudFront for my app that runs on Craft 3. DNS points to CF (CNAME), CF has Elastic Load Balancer (ELB) as a default origin. The ELB is a subdomain on my main domain (for certificates reasons). There is a CNAME set for ELB on the main domain DNS.

Now, when I'm visiting any page on my application, there is no redirection happening (eg. when I go to www.myapp.com/product). Only when I'm visiting the /admin panel, I get redirected to the ELB domain. Eg. I go to www.myapp.com/admin and I get redirected to www.elb-domain.awsloadbalancerdomain.com (ELB's CNAME).

Any of you has any ideas about why this might be happening and how to prevent it?

Thank you in advance!

2 Answers 2


As the issue is happening only with /admin URL, this might be related with cookies which are being passed to the backend application's /admin URL.

You may need to check with CraftCMS team (or some other forums) and get the list of cookies which are being used by the /admin URL. You can whitelist those cookies in cloudfront specifically for /admin URL.


I needed to whitelist Host, Origin and Referer in the Whitelist Headers section.

I've had more issues with CloudFront, wrote a blog post about it, maybe someone will find it helpful: https://medium.com/@justynazet/placing-a-craft-cms-application-behind-the-cloudfront-1602027ff72b

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.