简体   繁体   中英

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. add this config:

client_max_body_size xM

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM