【发布时间】:2023-03-10 12:20:02
【问题描述】:
我在 AWS 上有一个由 Elastic Beanstalk 提供支持的负载平衡环境。 SSL 证书应用于负载均衡器。为了强制 https 重定向,我遵循了这篇文章Redirect to https through url rewrite in IIS within elastic beanstalk's load balancer 中接受的答案。这些是我在 web.config 中编写的确切代码行
<rewrite>
<rules>
<rule name="Force Https" stopProcessing="true">
<match url="healthcheck.html" negate="true" />
<conditions>
<add input="{HTTP_X_FORWARDED_PROTO}" pattern="https" negate="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
但这会导致环境健康在发布后 5 分钟内变为红色,并且网站开始出现 503 错误。如果我删除它们,则没有错误。请帮我解决这个威胁,以便 https 重定向成功。在发布后的前 5 分钟内,http 请求成功重定向到 https。只有在 503 错误开始出现之后。
【问题讨论】:
标签: amazon-web-services redirect ssl iis