Videos not playing due to no Access Control Allow Origin

[亡魂溺海] 提交于 2019-12-23 05:17:22

问题


I am working on a web project, I just started using a JavaScript based video player in Wordpress. The video player works fine when using videos on the same server but when requesting videos from other servers it throws the error in browser console:

Failed to load http://techslides.com/demos/sample-videos/small.mp4: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://www.gozo.kitchen' is therefore not allowed access

I am trying to access the video on a different server.

I have tried locating the server configuration file but I cannot find it here's a summary of what I have done till now :

Server is running the linux operating system. I can find the nginx.config but its empty and enabling it to use CORS does not seem to solve the problem. The video still does not run.

There is no config file under the etc directory.

I need to enable CORS to access videos on other servers.


回答1:


You're requesting a resource from another server so the other server must allow you to retrieve it with an Access-Control-Allow-Origin header that matches your site details. You can disable this when you start chrome with the --disable-web-security flag but that should only be used for testing.



来源:https://stackoverflow.com/questions/48972459/videos-not-playing-due-to-no-access-control-allow-origin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!