强制 https aws elasticbeanstalk
Posted
技术标签:
【中文标题】强制 https aws elasticbeanstalk【英文标题】:force https aws elasticbeanstalk 【发布时间】:2017-06-14 06:43:30 【问题描述】:我的 symfony 应用程序部署在 AWS 弹性 beanstalk 实例中。
我只想使用 HTTPS 协议。我创建了这个文件: .elasticbeanstalk/https_rewrite.cfg.yml 包含以下内容:
files:
/etc/httpd/conf.d/ssl_rewrite.conf:
content: "LoadModule rewrite_module modules/mod_rewrite.so\n\
RewriteEngine On\n\
# This will enable the Rewrite capabilities\n\
RewriteCond %HTTPS !=on\n\
# This checks to make sure the connection is not already HTTPS\n\
RewriteRule ^/?(.*) https://%SERVER_NAME/$1 [R,L] \n"
group: root
mode: "000644"
owner: root
但它不起作用。
我使用亚马逊生成的证书。
有什么想法吗?
谢谢。
【问题讨论】:
是的,我阅读了此链接,但我在做什么?文件:/etc/httpd/conf.d/ssl_rewrite.conf:内容:“RewriteEngine On\n RewriteCond %HTTP:X-Forwarded-Proto =http\n RewriteRule . https://%HTTP:Host% REQUEST_URI [L,R=permanent]" 组:root 模式:"000644" 所有者:root 此内容无效。 是的,我使用了负载均衡器,是的,我认为请求没有重定向到 https,因为我们的浏览器中有安全徽标。是否可以使用负载均衡器强制 http 到 https 以在我的浏览器中显示安全徽标? 是的,但为什么我在浏览器 (Firefox) 中看不到绿色挂锁? 【参考方案1】:解决方案是将文件移动到 .ebextension 目录。
谢谢。
【讨论】:
以上是关于强制 https aws elasticbeanstalk的主要内容,如果未能解决你的问题,请参考以下文章