With nginx
can I specify Access-Control-Allow-Origin
using a wildcard like *.mydomain.com
?
Would it look like:
add_header Access-Control-Allow-Origin *.mydomain.com;
Thanks.
With nginx
can I specify Access-Control-Allow-Origin
using a wildcard like *.mydomain.com
?
Would it look like:
add_header Access-Control-Allow-Origin *.mydomain.com;
Thanks.
you have to do it with an if condition
Setting "Access-Control-Allow-Origin" based on conditions in nginx is very dangerous and you should be careful. The answer above is opening a security vulnerability.
This line will match something.mydomain.com and also something.mydomain.com.anyotherdomain.com (A domain anyone can create)
Doing this, will allow the following scenario:
fetch
.And all of that, because the regular expression is missing one '$' at the end.
Thats not the only way you can make that particular regexp bad, thats why I am explaining the problem, rather than just adding $ in the previous answer
You sure can. I use the following directive to support some of our cross domain fonts: