简体   繁体   中英

Browse IIS website with domain binding on localhost

I have two websites on local IIS (ver 8):

\Website1 (Binding: http:*:80:)
  Index.html
\Website2 (http:*:80:anotherwebsite.com)
  Index.html

Is there a way to browse locally IIS website Website2 ? Browsing anotherwebsite.com is wrong - DNS will point me to the "public" anotherwebsite.com . Browsing localhost/anotherwebsite.com is also wrong - this will browse Website1 .

I cannot change hosts file - this change has to be quick and easy (used for deployment heartbeat). I also don't want to add another binding (possible solution would be to add binding http:*:123: to Website2 and browse localhost:123 .

The only way is to get your web-browser to connect to localhost but to spoof the Host header. Fortunately there are Chrome and Firefox extensions to do this. Search online for "chrome extension spoof host-header" (or Firefox). There are no extensions yet available for MS Edge.

Another option is to use the venerable Fiddler tool, which is a local HTTP proxy that works on every web-browser and lets you change any outgoing headers too: fiddler: how to disable overwrite Header Host

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM