Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to configure cross-domain cors in nginx

Shulou Source: shulou.com Published: 2022-06-02 10:29:19 11月27日 Update

This article introduces how to configure cross-domain cors in nginx, the content is very detailed, interested friends can refer to, hope to be helpful to you.

Vhost configuration

Location / {add_header Access-Control-Allow-Origin $http_origin; add_header Access-Control-Allow-Methods GET,POST,OPTIONS; add_header Access-Control-Allow-Credentials true; add_header Access-Control-Allow-Headers DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type; add_header Access-Control-Max-Age 1728000 If ($request_method = OPTIONS) {add_header Access-Control-Allow-Origin $http_origin; add_header Access-Control-Allow-Methods GET,POST,OPTIONS; add_header Access-Control-Allow-Credentials true; add_header Access-Control-Allow-Headers DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type Add_header Access-Control-Max-Age 1728000; return 204;}} so much about how to configure cross-domain cors in nginx. I hope the above content can be helpful to you and learn more. If you think the article is good, you can share it for more people to see.

Tags: Configuration content more help good interest guys buddies articles knowledge articles references Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft MariaDB Linux macOS vpn