【问题标题】:Forward http to https - Elastic Beanstalk + Nginx将 http 转发到 https - Elastic Beanstalk + Nginx
【发布时间】:2023-03-10 13:00:01
【问题描述】:

我将 Elastic Beanstalk 与 Node.js 服务器、负载平衡和 Nginx 代理一起使用。我希望将所有地址 http://example.com 重新路由到 https://example.com

我已经尝试了下面的配置,它位于 .ebextensions 中,看起来像这样:

files:
  "/etc/nginx/conf.d/000_https_redirect.conf":
    mode: "000755"
    owner: root
    group: root
    content: |
      server {
        listen 80;
        return 301 https://$host$request_uri;
      }

我的负载均衡器有 80 指向 80 和 443 指向 80:

【问题讨论】:

    标签: node.js amazon-web-services ssl nginx amazon-elastic-beanstalk


    【解决方案1】:

    根据您的问题,尚不清楚到底出了什么问题,但也许您可以在重写条件下使用 x-forwarded-proto。

    我自己没有尝试过,但可能类似于:how to redirect http to https in nginx docker elastic beanstalk

    【讨论】:

      猜你喜欢
      • 2018-01-07
      • 2019-01-24
      • 2017-02-04
      • 2018-09-30
      • 2016-06-19
      • 2015-07-09
      • 2019-09-21
      • 2018-01-01
      • 2021-02-23
      相关资源
      最近更新 更多