Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
For a project deployed in the server, it is needed to make all of domains that contains "myCompany.com" accessible. It works if using
HTML
<add name="Access-Control-Allow-Origin" value="*" />

But not if using
HTML
<add name="Access-Control-Allow-Origin" value="myCompany.com" />

How can this problem be handled? Thanks.

What I have tried:

How to define the value for the "Access-Control-Allow-Origin" for sub-domain?
Posted
Updated 3-May-19 2:36am
Comments
F-ES Sitecore 2-May-19 11:41am    
I don't think this is supported out of the box, you'd need to explicitly add all of your sub-domains to the allow list. I'm sure if you google "iis access control allow origin sub domain" you'll find various solutions, pick one that suits you.

Enable CORS for specific domains in IIS using URL Rewrite[^]

Looks like there's ways of defining a range of URLs
 
Share this answer
 
I have found the solution for this problem. The approach is described below:
1) In the IIS7 Manager, click the project.
2) From the Feature View, click the icon for HTTP Response Headers.
3) For the "Access-Control-Allow-Origin", enter the values like that (having a single space between):
http://myCompany1.com http://myCompany2.com http://myCompany3.com
Remark: It has been done manually through IIS Manager, NOT on web.config. The revised values CANNOT be overwritten into the web.config.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900