【发布时间】:2018-08-18 02:05:34
【问题描述】:
这是我的配置:
server {
listen 80;
server_name *.example.com;
if ($http_x_forwarded_proto = 'http') {
return 301 https://$server_name$request_uri;
}
}
当我转到 example.com 时,nginx 将我重定向到 https://example.com,但该页面是一个存根 nginx index.html。 如果我去 www.example.com 它保持不安全,所以它根本不会被重定向。
我做错了什么? 谢谢。
编辑: 当我喜欢这篇文章时:https://aws.amazon.com/premiumsupport/knowledge-center/redirect-http-https-elb/
返回 301 https://$server_name$request_uri$http_x_forwarded_proto;
然后重定向https://example.com/http 当然是 404,因为 http 端点很愚蠢。
【问题讨论】:
-
我也试过这个解决方案。它也不起作用。 allcloud.io/how-to-force-https-behind-aws-elb
标签: spring-boot nginx amazon-elb