google storage vedio files cannot plays directly f

2019-08-17 03:14发布

has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access.

this message when trying to load wave file from google storage.

i tried these steps but it doesn't work, Use the gsutil cors command to configure CORS on a bucket: https://cloud.google.com/storage/docs/configuring-cors

1条回答
Evening l夕情丶
2楼-- · 2019-08-17 03:23

If you are using Chrome, I want to mention that Chrome does not support localhost for CORS requests (an error opened since 2010) [1], if you inspect the thread of this error, you will find the last comment made this year, therefore, this error is still in process for be resolved

To get around this you can use a domain like lvh.me (which points at 127.0.0.1 just like localhost) or start chrome with the --disable-web-security flag (assuming you're just testing).

Also you can check how you can use wildcards on Origin on this document[2]

[1] https://bugs.chromium.org/p/chromium/issues/detail?id=67743

[2] https://cloud.google.com/storage/docs/xml-api/put-bucket-cors

查看更多
登录 后发表回答