【发布时间】:2018-01-07 16:05:49
【问题描述】:
我有一个 Spring Boot 应用程序 (1.5.3),它在 Tomcat 容器上运行,Nginx 作为负载均衡器。 我创建了以下文件:
.ebextentions/nginx/conf.d/myapp.conf
我根据这个article添加了以下内容:
server {
if ($http_x_forwarded_proto != 'https') {
rewrite ^(.*) https://$host$1 redirect;
}
}
我已在证书管理器中安装 SSL 证书并在我的环境中设置它。现在应用程序同时服务于 HTTP 和 https 请求。我想将所有 HTTP 请求重定向到 https 而不会陷入重定向循环。但不起作用。
【问题讨论】:
-
如何将
.ebextensions放入 WAR 文件中进行部署,负载均衡器将如何从 WAR 中读取该文件? -
文件路径必须是
/.ebextensions/nginx/conf.d/elasticbeanstalk/。见serverfault.com/a/822596/123651
标签: amazon-web-services tomcat nginx spring-boot amazon-elastic-beanstalk