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.



  • 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. Apr 11, 2021 at 9:30
  • Thanks for the useful reply! With this help I found this thread: serverfault.com/questions/625362/… in the replies is an example for achieving it with nginx or (maybe with simpler configuration) with sniproxy serverfault.com/questions/625362/…
    – mathse
    Apr 11, 2021 at 12:34
  • Forwarding TCP connections means that visitor's IP address is lost for those connections. Apr 14, 2021 at 15:56


You must log in to answer this question.

Browse other questions tagged .