我的域返回纹理加载图像 url 错误 [英] My domain return error for texture load image url

查看:26
本文介绍了我的域返回纹理加载图像 url 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的域无法加载图像

其他域没问题.它正在工作

它只是不加载我的域

var textureLoader = new THREE.TextureLoader();textureLoader.crossOrigin = '';var map = textureLoader.load('https://MY-DOMAIN.com/upload/01.png');

<块引用>

错误: GET https://MY-DOMAIN.com/upload/01.png net::ERR_FAILED

注意:我在本地主机上工作.我从远程服务器拍照

解决方案

从您的服务器发送的响应标头中,我可以看到它没有返回 Access-Control-Allow-Origin 标头.这应该是 *.所以恐怕您必须正确配置您的服务器.

我注意到您正在使用 LiteSpeed Web Server,因此请查看他们的 Wiki 页面:https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:config:cors

如果我尝试通过代理为您提供图片,一切都很好.

var textureLoader = new THREE.TextureLoader();textureLoader.crossOrigin = '';var map = textureLoader.load('https://api.codetabs.com/v1/proxy?quest=https://zomisoft.com/blog_img/5-5bcf0cae447c36.35706243.png');

image does not load by my domain

Other domain no problem. it is working

it just doesn't load my domain

var textureLoader = new THREE.TextureLoader();
textureLoader.crossOrigin = '';
var map = textureLoader.load('https://MY-DOMAIN.com/upload/01.png');

Error : GET https://MY-DOMAIN.com/upload/01.png net::ERR_FAILED

Note : I'm working on localhost. I taking pictures from remote server

解决方案

From the response header your server sends I can see that it doesn't return a Access-Control-Allow-Origin header. This should either be <origin>or *. So I'm afraid you might have to configure your server properly.

I noticed you you're using LiteSpeed Web Server so have a look at their Wiki page: https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:config:cors

If I try to serve your image via a proxy everything's fine.

var textureLoader = new THREE.TextureLoader();
textureLoader.crossOrigin = '';
var map = textureLoader.load('https://api.codetabs.com/v1/proxy?quest=https://zomisoft.com/blog_img/5-5bcf0cae447c36.35706243.png');

这篇关于我的域返回纹理加载图像 url 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆