简体   繁体   English

被 CORS 策略阻止:无“访问控制允许来源”。 后台已经设置了相关的header或者相同

[英]Blocked by CORS policy: No 'Access-Control-Allow-Origin'. The backend has set the relevant header or the same

在此处输入图像描述

Only appears when uploading larger files, no problem when connecting to a file server in the LAN(not localhost).仅在上传较大文件时出现,连接到局域网中的文件服务器(不是本地主机)时没有问题。

Req:要求:

Error with this request:此请求出错: 在此处输入图像描述

This is right, the difference is just the file size.没错,区别只是文件大小。 在此处输入图像描述

Resp:回复:

Access-Control-Allow-Method = [POST]
Access-Control-Allow-Headers = [x-requested-with]
Access-Control-Allow-Credentials = [true]
Access-Control-Allow-Origin = [http://localhost:3000]

The default limit size of nginx is within 1M. nginx的默认限制大小在1M以内。 add this config:添加此配置:

client_max_body_size xM

暂无
暂无

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

相关问题 CORS 策略已阻止从原点 '' 访问 XMLHttpRequest - Access to XMLHttpRequest at '' from origin '' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present CORS 策略阻止了对获取的访问:请求的资源上不存在“Access-Control-Allow-Origin”header - Access to fetch has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource React 已被 CORS 政策阻止:没有“Access-Control-Allow-Origin”标头 - React has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header React 组件已被 CORS 策略阻止:请求的资源上不存在“Access-Control-Allow-Origin”header - React component has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource Cors 启用但仍然得到这个“来源已被 CORS 策略阻止:不存在'Access-Control-Allow-Origin'header” - Cors enabled but Still got this "Origin has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present " 来源'http:// localhost:3000'中的'已被CORS策略阻止:所请求的资源上没有'Access-Control-Allow-Origin'标头 - ' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource 来自源的 XMLHttpRequest 已被 CORS 策略阻止:请求的资源上不存在“Access-Control-Allow-Origin”标头 - XMLHttpRequest at from origin has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource CORS 策略已阻止对 XMLHttpRequest 的访问:请求套接字 io 上不存在“Access-Control-Allow-Origin”标头 - Access to XMLHttpRequest has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the request socket io Facebook登录引发对XMLHttpRequest的访问已被CORS策略阻止:不存在“ Access-Control-Allow-Origin”标头 - Facebook Login throws an Access to XMLHttpRequest has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present CORS 策略已阻止从 *** 从源 *** 获取访问权限:无“访问控制允许源” - Access to fetch at *** from origin *** has been blocked by CORS policy: No 'Access-Control-Allow-Origin'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM