How can I simulate CORS on my LOCAL machine?

.net, cors, iis-7, wcf, wcf-security

Solution

You can add any domain names you like to your hosts file (`%windir%\System32\Drivers\etc\hosts`) and map those back to `127.0.0.1`. Any requests to that domain will then be sent to your local machine.

Each domain name you add should be treated separately so far as CORS is concerned. If you're on a Windows Server SKU, you can even configure IIS to use multiple sites and configure it to examine host headers to determine which site responds to requests for each domain.

Problem

Is it possible ti create a web site in IIS7 which somehow could look like it sits in a different domain, so that from one of this site's pages I can test Cross-Origin-Resource-Sharing calls to a WCF service in my local host?

Original source