【问题标题】:how do i redirect https to http on nginx load balancer如何在 nginx 负载均衡器上将 https 重定向到 http
【发布时间】:2016-11-24 09:30:01
【问题描述】:

我正在使用 nginx 负载平衡器,我希望我的所有请求都从 https 重定向到 http

这是负载均衡器的配置 -

upstream web_app_backend {
    ip_hash;
    server app1.example.com;
    server app2.example.com;
}

server {
    listen 443 ssl;
    server_name example.com;
    ssl_certificate /etc/nginx/ssl/example.crt;
    ssl_certificate_key /etc/nginx/ssl/example.com.key;
    return 302 http://example.com$request_uri;
}

server {
    listen 80;
    server_name example.com;

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        proxy_pass  http://web_app_backend;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_cache_bypass $http_upgrade;
    }
}

【问题讨论】:

    标签: redirect ssl nginx load-balancing


    【解决方案1】:

    事实证明,我的443 端口被防火墙阻止了。 nginx配置没问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-05-12
      • 2020-08-23
      • 2018-06-07
      • 1970-01-01
      • 2014-08-27
      • 2015-03-18
      • 2017-02-19
      • 2017-02-20
      相关资源
      最近更新 更多