简体   繁体   English

我收到与Access-Control-Allow-Origin相关的错误消息

[英]I'm getting an error message related to Access-Control-Allow-Origin

I'm working with a landing page that uses cdn plyr 我正在使用使用cdn plyr的登录页面

<script src="https://cdn.plyr.io/3.3.10/plyr.js"></script> 
    <script>const player = new Plyr('#player');</script> 

I moved a video from local files to a server and changed the src="to new address form server" , but the video stopped working and I'm getting this error: 我将视频从本地文件移动到服务器,并将src="to new address form server"更改src="to new address form server" ,但是视频停止工作,并且出现此错误:

page.html:1 Failed to load https://www.video.mp4 : No 'Access-Control-Allow-Origin' header is present on the requested resource. page.html:1无法加载https://www.video.mp4 :所请求的资源上没有“ Access-Control-Allow-Origin”标头。 Origin ' http://111.0.0.0:12121 ' is therefore not allowed access. 因此,不允许访问源' http://111.0.0.0:12121 '。

I tired different things, and even added another videos from other servers and it worked. 我厌倦了不同的事情,甚至从其他服务器添加了另一个视频,它也起作用了。 except my video. 除了我的视频。 The only thing that work is to add crossOrigin="anonymous" to the video tag and install Chrome extension But this wont work for other users, I need something permanent. 唯一可行的方法是将crossOrigin="anonymous"添加到视频标签并安装Chrome扩展程序,但这对其他用户不起作用,我需要永久的东西。

I also looked in to many answers: 我还查看了许多答案:

How does Access-Control-Allow-Origin header work? Access-Control-Allow-Origin标头如何工作?

Videos not playing due to no Access Control Allow Origin 由于没有访问控制允许来源而无法播放视频

HTML5 video doesn't play with crossOrigin=“anonymous” HTML5视频无法与crossOrigin =“ anonymous”一起播放

Please any ideas how to make this work? 请任何想法如何使这项工作?

This is a problem caused when you try to send request from a server that is different from the server you send request to. 当您尝试从与向其发送请求的服务器不同的服务器发送请求时,这是一个问题。 As in the comment was indicated, only the server you have uploaded your video to can control the header. 如注释中所示,只有您上传视频的服务器才能控制标题。 But if it's your own server you can easily manipulate the code to allow request from different servers. 但是,如果是您自己的服务器,则可以轻松地操纵代码以允许来自不同服务器的请求。

尝试此操作以获取有关如何在服务器上启用W3C CORS的参考

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何解决无“访问控制允许来源”问题? - How can i resolve the No 'Access-Control-Allow-Origin' problem? 错误:不存在“ Access-Control-Allow-Origin”标头。 即使我添加了它 - Error: No 'Access-Control-Allow-Origin' header is present. Even though I have added it 如何实现访问控制允许来源:* - How to implement Access-Control-Allow-Origin:* 错误:请求的资源上没有“Access-Control-Allow-Origin”标头。 使用expressjs和angular - Error: No 'Access-Control-Allow-Origin' header is present on the requested resource. Using expressjs and angular CORS 策略错误:“Access-Control-Allow-Origin”标头包含多个值“*”、“*”,但只允许一个 - CORS policy error: The 'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed 请求的资源上不存在“Access-Control-Allow-Origin”header。 节点服务器,我已将原点应用于 Cors - No 'Access-Control-Allow-Origin' header is present on the requested resource. NODE-server, I have applied an origin to Cors 为我的JS AJAX获取“请求的资源上没有“ Access-Control-Allow-Origin”标头。”而不是“ 404:未找到文件” - Getting “No 'Access-Control-Allow-Origin' header is present on the requested resource.” for my JS AJAX instead of “404: File Not Found” Access-Control-Allow-Origin:所有用户只能访问一个站点 - Access-Control-Allow-Origin: Access for all users just to one site 程序在JavaScript中抛出“ Access-Control-Allow-Origin”标头? 在Postman中工作,而不是通过浏览器工作 - Program throws 'Access-Control-Allow-Origin' header in JavaScript? Works in Postman, not through browser 修复在Eclipse上的插件开发中缺少CORS标头Access-Control-Allow-Origin - Fix CORS header Access-Control-Allow-Origin missing on plugin development on eclipse
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM