0

For example. User request http://user.dist.com, the request will firstly arrived at nginx server,

upstream a.hello.com {
     server 10.243.26.104:8800;
 }
 server
  {
    listen 80;
    server_name user.dist.com;
    location /
    {
      proxy_pass http://a.hello.com;
    }
  }

and the server a.hello.com is running at Node.js, the Node sever want to get the real origin request host which should be user.dist.com, but now, the Node server get a.hello.com, so how to get the origin host?

laoqiren
  • 3,457
  • 5
  • 19
  • 29
  • can u please check : https://stackoverflow.com/questions/6045020/how-to-redirect-to-a-different-domain-using-nginx its help you to how to redirect to other domain – IftekharDani Aug 02 '18 at 05:40

1 Answers1

0

you can use proxy_set_header-

proxy_set_header HOST $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Fazal Rasel
  • 4,446
  • 2
  • 20
  • 31