IIS CORS Access-Control-Allow-Origin' header contains multiple values

3369
4
05-10-2022 05:12 AM
Vakhtang_Zubiashvili
Occasional Contributor III

Hi all,

Again, i am about CORS issue.

I sue IIS for my web map.

So, in my map i sue wms service from another server, that's why i get CORS issue. When i use CORS extension on chrome, i can use this service without problem. 

I looked around in google, in stack, but could not find decision of this. 

In web.config i have added:

 

 

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.webServer>
        <httpProtocol allowKeepAlive="false">
            <customHeaders>
              <clear />
                <add name="Access-Control-Allow-Origin" value="*" />
                <add name="Access-Control-Allow-Methods" value="GET, PUT, POST, DELETE, HEAD, OPTIONS" />
                <add name="Access-Control-Allow-Headers" value="*" />
            </customHeaders>
        </httpProtocol>
    </system.webServer>
</configuration>

 

 

but no result, still  Access-Control-Allow-Origin' header contains multiple values. 

My map is in Default web Site folder. 

I used proxy, but it did  not help.

Any ideas how it could be fixed?

4 Replies
ReneRubalcava
Frequent Contributor

edit - Is this on the server you are trying to get the WMS from?

0 Kudos
Vakhtang_Zubiashvili
Occasional Contributor III

WMS is outsource, it is on another server and i have no access on it to change CORS options. 

0 Kudos
ReneRubalcava
Frequent Contributor

Ah, you can't fix this via your server then. The origin server has deliberately disabled CORS or only has certain allows. You can try to write a proxy server for this. The crossorigin.me dev site publishes their source code and you can try to use that as a base for your own. https://github.com/corihudson/crossorigin.me

0 Kudos
AdrianaPaese
Occasional Contributor

The CORS extension on Chrome has helped me too. Thank you