masalah cors pada nginx method options

Bismillaahirrohmaanirrohiim…

berikut ini tambahan kode pada vhost nginx untuk memperbolehkan cors method options

  {{settings}}

  location / {
    if ($request_method = OPTIONS) {
        add_header Access-Control-Allow-Origin "https://namadomainfrontend.com" always;
        add_header Access-Control-Allow-Methods "GET, POST, OPTIONS" always;
        add_header Access-Control-Allow-Headers "Content-Type, Authorization, X-Client-Session, X-Remember-Token, X-Referral-Code, X-App-Key, X-Client-Timezone, X-Client-Utc-Offset" always;
        add_header Access-Control-Max-Age 86400 always;
        add_header Content-Length 0 always;
        return 204;
    }
    {{varnish_proxy_pass}}
    proxy_set_header Host $host;

Demikian

Bagikan
Baca Juga:   Setting php.ini agar website berjalan optimal

You May Also Like

About the Author: rasupe

Discover more from Rasupe

Subscribe now to keep reading and get access to the full archive.

Continue reading