I am migrating a site to a new location with another ip address.
To smooth the transition for users and avoid as much downtime as possible, I plan to change DNS and then proxy requests from the old to the new server.
But my proxy test in nginx is not working, and I am not able to figure out why. I just get a totally blank page in the browser. There is nothing in the nginx error log. At the other end, there is no incoming request. The below proxy configuration is working fine in our current setup where we proxy from nginx to 3 webservers (loadbalancing) from port 443 to port 80.
I wonder if the trouble could be related to SSL->SSL proxy? Should I proxy 443->443, or 443->80 or 80->443?
test-proxy.example.com -> test.example.com
server {
listen 12.34.56.78:443;
server_name test-proxy.example.com;
ssl on;
ssl_certificate /etc/letsencrypt/live/test-proxy.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/test-proxy.example.com/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
location / {
proxy_pass https://test.example.com:443;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
proxy_buffering off;
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: https;
proxy_set_header Connection "";
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
}
}
# test-proxy.example.com 80
server {
listen 12.34.56.78:80;
server_name test-proxy.example.com;
#Let's Encrypt: Let requests for acme challenge pass
include /etc/nginx/acme.conf;
location / {
rewrite ^(.*) https://test-proxy.example.com$1 permanent;
}
}