URL redirect, retain original URL

Discussion in 'Nginx' started by mikemo, Aug 22, 2016.

  1. #1
    I'm reverse proxying to a different domain but want to retain the original URL so the user doesn't realize they're being redirected.

    Config attached.
     

    Attached Files:

    mikemo, Aug 22, 2016 IP
  2. UrlEmbed

    UrlEmbed Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #2
    Just use rewrite:
        location / {
          rewrite    /(.*) /$1 break;
          proxy_pass                  http://domain1.net/;
          proxy_set_header        Host $http_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_read_timeout     90;
          proxy_redirect              https://domain1.com http://domain1.net;
        }
    Code (markup):
     
    UrlEmbed, Nov 2, 2016 IP