1
リモートExpress.jsサーバーからAngular/IonicアプリにPLYファイルをダウンロードしようとしています。 Amazon AWSで私のイオニックアプリを今すぐホストしています。私は私のExpress.jsサーバに以下のいるCORS with Express.jsとAngular2
//this.currentPlyFile encompasses entire URL
document.getElementById('entity').setAttribute("ply-model", "src: url(" + this.currentPlyFile + ".ply);");
:ここで活字体は、イオンアプリからだ
app.use(function(req, res, next) {
res.header('Access-Control-Allow-Credentials', true);
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET,POST');
res.header('Access-Control-Allow-Headers', 'appid, X-Requested-With, X-HTTP-Method-Override, Content-Type, Accept');
if ('OPTIONS' == req.method) {
res.send(200);
} else {
next();
}
});
しかし、私はPLYファイルを要求、次のエラーを取得:
XMLHttpRequest cannot load "my url here" No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'my url here' is therefore not allowed access.
を
CORSを許可するExpress.jsのドキュメントで提供されているヘッダーを使用しているので、これは本当にイライラしています。