Summary
My Express server returned a redirect URL response, such as redirect tohttps://domain_A.com/babababa
I used IIS URL Rewrite to redirect URL request to my Express server. Requests through IIS to Express Server, the returned redirect URL has been modified, domain changed to my domain, such as
changed from https://domain_A.com/babababa to https://my-Domain.com/babababa
Question Details
my Express Server
My Express server started on http://localhost:8022, If I go to the route http://localhost:8022/login, it will redirect me to a page outside my network https://domain_A.com/babababa
my IIS and URL rewrite setup
I have setup my IIS to connect to my Express server using URL Rewrite.
- My IIS in my domain:
https://my-Domain.com - URL rewrite setup:
https://my-Domain.com/Expresswill forward the request tohttp://localhost:8022 - as a result, if I go to
https://my-Domain.com/Express/login, the request forwarded to Express server, which is same as going tohttp://localhost:8022/login
Testing
If I go to my express server directly by URL http://localhost:8022/login, I can see my page redirect to https://domain_A.com/babababa?... correctly. In developer console > Response Headers > Location it shows https://domain_A.com/babababa?...
If I go through the IIS by URL https://my-Domain.com/login, in result I have been redirect to a wrong URL https://my-Domain.com/babababa?... (this page not exists)
In developer console > Response Headers > Location it shows https://my-Domain.com/babababa?...
I believe the response location's domain is replaced by my domain.
root cause and fixing?
Any ideas why my IIS response redirect URL's domain being modified? any information and suggestion of how to fix are appreciated! Thanks for any help!



