0

I have a runninig server with multiple services on subdomains running on it (all using https), with nginx as reverse proxy. In some days I will move everything 1:1 to another server (new IP, new location). The problem is, that the change of the DNS entries to the new server will definetly lag behind for some days, as another person has to change them. During this time, I want to just redirect every request (coming because of outdated DNS entries) to my old serve to the new one. I thought about a simple way with nginx, but due to the fact, that all services are behind https, I can't do a simple redirect like:

upstream newserver {
  server XXX.XX.X.X;  # this is new server, by IP address
}

server {
  listen 80 default_server;
  server_name "";
  location / {
    proxy_set_header Host $host;
    proxy_pass http://newserver;
  }
}

Can anybody give me a hint how I can simply forward (or redirect) all the traffic to the new server, without having to edit every single service (virtual server) configuration file on the old server? Preferably I would use nginx - but another option would also be no problem.

Greetings

mathse

mathse
  • 3
  • 1
  • I haven't tried this, but you may be able to forward port 443 to the new IP address using an Nginx stream proxy server. – Richard Smith Apr 11 '21 at 09:30
  • Thanks for the useful reply! With this help I found this thread: https://serverfault.com/questions/625362/can-a-reverse-proxy-use-sni-with-ssl-pass-through in the replies is an example for achieving it with nginx or (maybe with simpler configuration) with sniproxy https://serverfault.com/questions/625362/can-a-reverse-proxy-use-sni-with-ssl-pass-through – mathse Apr 11 '21 at 12:34
  • Forwarding TCP connections means that visitor's IP address is lost for those connections. – Tero Kilkanen Apr 14 '21 at 15:56

0 Answers0