Solved: No 'Access-Control-Allow-Origin' header is present on the requested resource caused by Nginx when uploading files.

Problem Description

  1. This looks like an ordinary cross-domain, but the cause of the cross-domain is Nginx
  2. Aliyun oss, which needs to upload files on my side, uses Nginx. After checking the front and back ends, no errors were found, and the cross-domain configuration is also normal.

cause of the problem

  1. Nginx has a default upload file size limit. The uploaded file on my side is relatively large, about 160M, but Nginx limits the uploaded file size to 1M by default, so my side is because the upload of a large file timed out, and then exploded cross-domain !

solution

Modify the parameters of nginx: nginx.conf, plus this line of configuration (two locations)

client_max_body_size 1024m;

insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/qq_43408367/article/details/128465864