如何强制在Amazon Elastic豆茎HTTPS,而不会导致健康检查 [英] How to force https on amazon elastic beanstalk without failing the health check

查看:243
本文介绍了如何强制在Amazon Elastic豆茎HTTPS,而不会导致健康检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经配置我的魔豆弹性的环境中重定向所有页面到HTTPS,重定向的工作原理,但是,在实例失败的健康检查,并得到终止,任何想法如何配置重写规则?

我的配置:

 了NameVirtualHost *:80<虚拟主机*:80>


。RewriteEngine叙述在
的RewriteCond%{HTTP:X - 转发,原}!HTTPS
!重写规则/ _ hostmanager /健康检查的https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
< /虚拟主机>


解决方案

有这么弹性魔豆需求除了健康检查,以访问多个hostmananger的URL。 Grepping /无功/日志/的httpd / elasticbeanstalk-的access_log ,我看到请求 / _ hostmanager /任务 / _ hostmanager /健康检查

下面是我加入的/ etc / httpd的/网站/ elasticbeanstalk 我的EC2实例的规则:

  RewriteEngine叙述在
的RewriteCond%{HTTP:X - 转发,原}!HTTPS
的RewriteCond%{REQUEST_URI}!^ / $状态
的RewriteCond%{REQUEST_URI}!^ / $版本
的RewriteCond%{REQUEST_URI}!^ / _ hostmanager /
重写规则。 https://开头%{SERVER_NAME}%{REQUEST_URI} [L,R]

请注意,我也允许非HTTPS流量到我的 /状态 /版本页。实际上,我使用 /状态作为实际状况检查查找网址,所以有流量跳过重写将避免重定向,使状态查找速度更快(我假设)

I have configured my Elastic Beanstalk environment to redirect all pages to https, redirection works, however, the instance fails the health check and gets terminated, any ideas how to configure the rewrite rules?

My configuration:

NameVirtualHost *:80

<VirtualHost *:80>
.
.
.

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule !/_hostmanager/healthcheck https://%{SERVER_NAME}%{REQUEST_URI} [L,R] 
</VirtualHost>

解决方案

There's multiple hostmananger URLs that Elastic Beanstalk needs to access besides the health check. Grepping /var/log/httpd/elasticbeanstalk-access_log, I see requests to /_hostmanager/tasks and /_hostmanager/healthcheck.

Here are the rules that I added to /etc/httpd/sites/elasticbeanstalk on my EC2 instances:

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{REQUEST_URI} !^/status$ 
RewriteCond %{REQUEST_URI} !^/version$ 
RewriteCond %{REQUEST_URI} !^/_hostmanager/ 
RewriteRule . https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

Note that I'm also allowing non-https traffic to my /status and /version pages. I'm actually using /status as the actual healthcheck lookup URL, so having that traffic skip the rewrite will avoid the redirect and make the status lookup faster (I'm assuming).

这篇关于如何强制在Amazon Elastic豆茎HTTPS,而不会导致健康检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆