Nginx solves cross-domain problems

how to use nginx to solve cross-domain problems. The interface ends with .do, and how to solve cross-domain problems through nginx

 server {
        listen       80;
        server_name  localhost;
        location ~* (\.do)$ {
            // 
        }
 }
Mar.29,2021

 server {
        listen       80;
        server_name  localhost;
        location ~* (\.do)$ {
           add_header Access-Control-Allow-Origin *;
            add_header Access-Control-Allow-Methods 'GET, POST, PUT, DELETE, OPTIONS';
            add_header Access-Control-Allow-Credentials 'true';
            add_header 'Access-Control-Allow-Headers' 'Accept, Authorization,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
            if ($request_method = 'OPTIONS') {
               add_header 'Access-Control-Allow-Origin' *;
               add_header 'Access-Control-Max-Age' 1728000;
               add_header 'Access-Control-Allow-Credentials' 'true';
               add_header 'Access-Control-Allow-Methods' 'GET, POST, DELETE, PUT, OPTIONS';
               add_header 'Access-Control-Allow-Headers' 'Accept, Authorization,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
               add_header 'Content-Type' 'text/plain charset=UTF-8';
               add_header 'Content-Length' 0;
               return 204;
           }
        }
 }

server {
    listen       80;
    server_name  localhost;
    location ~* (\.do)$ {
        proxy_set_header Host $host;
           add_header 'Access-Control-Allow-Origin' '*';
       add_header 'Access-Control-Allow-Credentials' 'true';
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
 }

Cross-domain problems should not be solved in nginx, and rough addition of set_header will cause problems. Nginx will not verify these set_header , but will cause some problems that are easy to confuse browsers.

Cross-domain problems must be solved in the background, and the back-end framework must be able to deal with cross-domain problems. Let the developer change the code

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e45eb5-4cf0f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e45eb5-4cf0f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?