简体   繁体   English

为什么我的 aws elastic beanstalk 侦听器基于路径的转发规则不起作用?

[英]Why is my aws elastic beanstalk listener path-based forward rule not working?

I have 2 "forward to" rules on an HTTP port 80 listener (see image).我在 HTTP 端口 80 侦听器上有 2 个“转发到”规则(见图)。 If a browser requests http://{domain}/health or http://{domain}/health/, these rules are supposed to forward traffic to the target group at the current port.如果浏览器请求 http://{domain}/health 或 http://{domain}/health/,则这些规则应该将流量转发到当前端口的目标组。

If they don't, traffic should be redirected to the HTTPS port 443.如果没有,则应将流量重定向到 HTTPS 端口 443。

我的规则与指南的规则相似

Unfortunately, requesting /health/ or /health still sends me down the https 443 port.不幸的是,请求 /health/ 或 /health 仍然会将我发送到 https 443 端口。 This is causing issues for the ELB health checker (described more in this guide https://medium.com/@Pibastte/how-to-setup-http-to-https-redirection-for-a-django-application-on-aws-elastic-beanstalk-and-have-de44cf05565 ).这会导致 ELB 运行状况检查器出现问题(本指南https://medium.com/@Pibastte/how-to-setup-http-to-https-redirection-for-a-django-application-on-中有更多描述aws-elastic-beanstalk-and-have-de44cf05565 )。 My rules are exactly the same as in that guide*.我的规则与该指南中的完全相同*。

So what's going on?发生什么了? Any help is appreciated:)任何帮助表示赞赏:)

*Edit: Woop I just realized that I forgot to mention that I rigorously tried paths both with and without the asterisk at the beginning. *编辑:哎呀,我刚刚意识到我忘了提到我在开始时严格尝试了带星号和不带星号的路径。

Based on the comments.根据评论。

The listener rules are correct .监听器规则是正确的。 The rules were verified using:使用以下方法验证规则:

curl -i http://{domain}/health/

which returned HTTP 200 , rather then HTTP 301 (redirection), as expected.正如预期的那样,它返回HTTP 200 ,而不是 HTTP 301 (重定向)。

It also should be noted, that browsers can force http to https redirection.还应该注意的是,浏览器可以强制httphttps重定向。 Thus its always better to check any HTTP requests using curl .因此,使用curl检查任何 HTTP 请求总是更好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 HTTPS 不工作(在基于 AWS Elastic Beanstalk 的站点上) - HTTPS not working (on AWS Elastic Beanstalk based site) Kubernetes nginx HTTPS 在 AWS 中的基于入口路径的路由 - Kubernetes nginx ingress path-based routing of HTTPS in AWS AWS Elastic Beanstalk部署无法正常工作 - AWS Elastic Beanstalk deploy not working 为什么我的Rails应用程序无法部署到AWS Elastic Beanstalk? - Why is my Rails App failing to deploy to AWS Elastic Beanstalk? 在 AWS Elastic Beanstalk 中创建 https 侦听器失败 - https listener creation fails in AWS Elastic Beanstalk .ebextension 在 AWS Elastic Beanstalk 中不起作用 - .ebextension is not working in AWS Elastic Beanstalk AWS ALB 创建基于路径的路由 - 将子目录重定向到根目录 - AWS ALB Create Path-Based Routing - Redirect subdirectory to root AWS Elastic Beanstalk HTTPS无法正常工作 - AWS Elastic Beanstalk HTTPS not working 为什么我通过 CLI 创建的 Elastic Beanstalk 应用程序没有显示在在线 AWS Elastic Beanstalk 控制台上? - Why is my Elastic Beanstalk application created through the CLI not showing up on the online AWS Elastic Beanstalk console? 为什么AWS Elastic beantalk无法构建我的应用程序? - Why does AWS elastic beanstalk fail to build my app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM