cesium加载所有外部资源都需要服务器端允许跨域;解决方法在服务器端;
1.若服务端可控:添加跨域头
2.若服务器端不可控:添加代理服务器
nginx添加代理示例:
location /3dtiles{
include nginx_cors;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://61.181.250.183;
}
网友评论