'set access-control-allow-origin response header only for static files in IIS
I'm using IIS to serve static files and also to send API requests to a python backend server.
for API requests the backend correctly sets CORS-related headers but for static files, I get errors. additionally, I can't set these in Response Headers in IIS because it conflicts with those set with the backend app.
So is there any way in IIS to check if some certain header is empty or requested response is a file or even check URI for a pattern like /static/ and then modify the response header?
I've reached to URLRewrite so far but I doubt it could modify the header.
Solution 1:[1]
after a little bit of digging it turned out you can set Response Header specific to each directory. so I set the CORS-related headers in my ./static/ sub-directories and it works fine.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | omid |
