การกำหนดค่า nginx ที่มีอยู่ระบุไว้ด้านล่าง ฉันลองหลายวิธีแล้ว แต่ไม่มีอะไรทำงาน

server {
    server_name backend.xxxxxx.com www.backend.xxxxxx.com;
    client_max_body_size 100M;
    #add_header Access-Control-Allow-Origin *;
    #add_header 'Access-Control-Allow-Origin' '*' always;
    location / {
        #add_header 'Access-Control-Allow-Origin' '*' always;
        include proxy_params;
        proxy_pass http://unix:/var/log/gunicorn/xxxxxx.sock;

        # Simple requests
        #if ($request_method ~* "(GET|POST)") {
                #add_header "Access-Control-Allow-Origin"  *;
        #}

        # Preflighted requests
        #if ($request_method = OPTIONS ) {
        #       add_header "Access-Control-Allow-Origin"  *;
        #       add_header "Access-Control-Allow-Methods" "GET, POST, OPTIONS, HEAD";
        #       add_header "Access-Control-Allow-Headers" "Authorization, Origin, X-Requested-With, Content-Type, Accept";
        #       return 200;
        #}
    }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/backend.xxxxxx.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/backend.xxxxxx.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

server {
    if ($host = backend.xxxxxx.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    listen 80;
    server_name backend.xxxxxx.com www.backend.xxxxxx.com;
    client_max_body_size 100M;
    return 404; # managed by Certbot


}

ใน Django ฉันได้เพิ่มdjango-cors-headersปลั๊กอินพร้อมการกำหนดค่าทั้งหมด ต้องการคำแนะนำจากผู้เชี่ยวชาญของคุณ

no answer