2017-06-15 30 views
0

有很多關於'Access-Control-Allow-Origin'的主題,但是我找不到一個爲Openseadragon這是子域名。我的網站是exampple.domain.com試圖從anotherexampple.domain.com打開DZI和我有一個錯誤:對於具有2個不同子域/ CORS問題的相同域,沒有「Access-Control-Allow-Origin」

XMLHttpRequest cannot load anotherexampple.domain.com/123.dzi. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'exampple.domain.com' is therefore not allowed access.

兩個網站都使用相同的HTTPS協議,和服務器是IIS

exampple.domain.com服務器設置了:

訪問控制允許來源:*

和Server for anotherexampple.domain.com設置有:

訪問控制允許來源:* .domain.com

此外,openseadragon有設置:

crossOriginPolicy: 'Anonymous', 
ajaxWithCredentials: false, 

有人可以告訴我如何解決與不同子域相同的域的CORS問題?提前致謝。

+0

[請不要將標記置於問題標題中](https://stackoverflow.com/help/tagging) – Liam

+0

「有人可以告訴我如何修復與不同子域相同域的CORS問題嗎?」 - 以同樣的方式爲任何其他不相同的原點修復交叉原點問題。 – Quentin

回答

3
Access-Control-Allow-Origin: *.domain.com 

Access-Control-Allow-Origin頭不支持局部通配符。

使用*或完整的原產地名稱。

您可以閱讀Origin請求標頭,使其與模式相匹配,然後在服務器上將其回顯出來,如果您想將特定域上的所有內容列入白名單。

No 'Access-Control-Allow-Origin' header is present on the requested resource.

你可能有試圖設置Access-Control-Allow-Origin頭,但它顯然沒有奏效。你需要重新檢查你的配置。

+0

我改變了它,但仍然不起作用。但是謝謝你讓我知道。這是愚蠢的錯誤。 – Observer

+0

,這條線在哪裏? –

+0

@ZloySmiertniy - 什麼行? – Quentin

相關問題