「いいえ 『アクセス制御 - 許可原点』ヘッダが」失敗、私は、次のコードを使用して、アマゾンS3から画像をロードする:、アマゾンS3バケットにTHREE.TextureLoaderロード画像はthreejsで
var loader = new THREE.TextureLoader();
loader.setCrossOrigin('');
loader.load(image_url,
function (texture) {
// do something with the texture
var sphere = new THREE.Mesh(
new THREE.SphereGeometry(radius, 20, 20),
new THREE.MeshBasicMaterial({
map: texture
})
);
sphere.scale.x = -1;
scene.add(sphere);
},
// Function called when download progresses
function (xhr) {
// console.log((xhr.loaded/xhr.total * 100) + '% loaded');
},
// Function called when download errors
function (xhr) {
console.log('An error happened');
}
);
をクロス起源を送信するために、すべての起源を可能に私も設定CORSは
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>HEAD</AllowedMethod>
<AllowedMethod>GET</AllowedMethod>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
は、同様の質問からいくつかのawnsersによると、私はちょうどloader.setCrossOrigin(「」)を設定する必要が要請します。
しかし、動作しません。 CORSのエラーがまだ発生します。
XMLHttpRequest cannot load https://s3-ap-southeast-1.amazonaws.com/.../test_image.jpg
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.
私はThreeJSの最新バージョンを使用しています。
誰でも手伝いできますか?すべてのサポートに感謝します。
[固定]
AS3に前にアップロードされた私の写真はまだクロスオリジン・リクエストを送信することはできません古いCORS設定の影響を受けているようです。
古い写真を削除して、新しいものをアップロードして問題を解決しました。
私はあなたのやり方を試していますが、うまくいきません。 – hauca