简体   繁体   English

AWS Cloudfront删除自定义域名并重定向到Elastic Beanstalk

[英]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服务SSL(ASP.Net MVC)的弹性beantalk环境。 CloudFront has a custom domain name. CloudFront具有自定义域名。 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. 一切正常,直到用户的会话cookie过期或用户尝试不登录而访问安全区域并重定向到登录页面。 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. 当这两种情况中的任何一种发生时,都会以某种方式将用户重定向到实际的弹性beantalk环境,并且它还会丢弃SSL,因此,如果用户没有注意到他们将在没有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. 例如,如果用户未登录即访问https://custom.domain.com/admin ,则他们将被重定向到http://aws.elasticbeanstalkcontainer.com ,会话过期也是如此。 It worked fine on IIS10 before migrating to AWS. 在迁移到AWS之前,它在IIS10上运行良好。 It seems that when EC2 sends the redirect back somehow CloudFront is missing it and not changing it to the custom domain name. 看来,当EC2将重定向发送回时,CloudFront会丢失它,并且未将其更改为自定义域名。 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. 监视来自服务器的重定向响应并用其他域名重写它们不是CloudFront的工作。 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. 您必须配置在Elastic Beanstalk上运行的应用程序,以了解将重定向响应发送回客户端时应使用的正确域名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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