公司内部图片服务器
192.168.1.17:6680/imgweb/
已确认该服务可以正确访问并使用
其中
拥有两张图片
1、http://192.168.1.17:6680/imgweb/resources/share/1570677374969_401.jpg
2、http://192.168.1.17:6680/imgweb/resources/share/1575255135944_888.jpg
图片1为手动上传,图片2为程序上传
前端集成富文本编辑器tinymce 过程中(可忽略)
发现 使用
以下代码出现异常情况
params:url, headers, withCredentials
var xhr = XMLHttpRequest();
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
resolve({
status: xhr.status,
blob: this.response
});
}
};
xhr.open('GET', url, true);
xhr.withCredentials = withCredentials;
global$1.each(headers, function (value, key) {
xhr.setRequestHeader(key, value);
});
xhr.responseType = 'blob';
xhr.send();
出现异常 并且只有图1的情况出现异常
Access to XMLHttpRequest at 'http://192.168.1.17:6680/imgweb/resources/share/1570677374969_401.jpg' from origin 'http://192.168.1.3:8083' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Uncaught (in promise) ImageProxy HTTP error: Incorrect Image Proxy URL
图二可以正常访问
请帮忙分析原因和提出改进方式
或留下部分分析结果以及联系方式
本人联系方式 qq 380389309(不常用)
请各位仔细阅读我发生问题的现象,并且进行分析后回答,不要回复我跨域如何配置,注意事项,需要解析为何同服务器一张图片可以正常访问,另外一张不可以。当然,问题原因确实事跨域导致的,当前情况事跨域现象一定会发生,服务器已经配置了允许跨域,但是部分图片文件报错。