简体   繁体   中英

AWS Cloudfront drops custom domain name and redirects to Elastic Beanstalk

I have an elastic beanstalk environment with CloudFront serving SSL (ASP.Net MVC). CloudFront has a custom domain name. Everything works fine until the user's session cookie expires or the user tries to access a secured area without logging in and is redirected to the login page. When either of these two things happens, the user is somehow redirected to the actual elastic beanstalk environment and it also drops SSL, so if the user doesn't notice they'll be sending their login credentials without SSL. For example, if the user accesses https://custom.domain.com/admin without being logged in they get redirected to http://aws.elasticbeanstalkcontainer.com , same for session expiration. It worked fine on IIS10 before migrating to AWS. It seems that when EC2 sends the redirect back somehow CloudFront is missing it and not changing it to the custom domain name. Any help will be greatly appreciated. Thanks in advance.

It is not CloudFront's job to monitor for redirect responses coming from your server and rewrite them with a different domain name. That's not something it does. You have to configure your application running on Elastic Beanstalk to be aware of the correct domain name it should use when it sends redirect responses back to the client.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM