[英]how do i redirect https to http on nginx load balancer
I am using a nginx load balancer and i want all of my requests to redirect from https to http . 我正在使用Nginx负载平衡器,并且我希望所有请求都从https重定向到http 。
Here is how the configuration for the load balancer looks like - 负载均衡器的配置如下所示-
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;
}
}
As it turns out, my 443
port was blocked by the firewall. 事实证明,我的443
端口已被防火墙阻止。 The nginx configuration is no problem. Nginx配置没有问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.