0

I have a sub-domain in a domain called firstdomain.com as subdmain.firstdomain.com

I have another domain as secondomain.com.

subdmain.firstdomain.com is pointing to the IP address of secondomain.com.

secondomain.com is running on a nginx server. The nginx server then forwards the request (proxy pass) to my application server running on a private network.

What I want to do is as following: If someone types in a url as subdomain.firstdomain.com, the nginx needs to recieve the request at secondomain.com (I think I need to have server blocked with subdomain.firstdomain.com) and do a proxy pass to application server in my private network and gets the response and sends back to the client. This needs to be done without changing the URL in the User browser (i.e. it has to stay as subdomain.firstdomain.com.)

Challenge to this problem is that the secodomain writes cookies (session information) which is used further by secondomain.com.

Any help will be appriciated.

server {
listen       80;
server_name subdomain.firstdomain.com;
location / {
    proxy_pass http://app.seconddomain.prd; #proxy pass to my app server on private network
    #here it needs to be done to make above work
}

}

4

0 回答 0