您现在的位置是:亿华云 > 系统运维

一文看懂Nginx如何配置跨域,值得收藏

亿华云2025-10-08 20:55:13【系统运维】5人已围观

简介复制location/{ add_headerAccess-Control-Allow-Origin*; add_headerAccess-Control-

一文看懂Nginx如何配置跨域,值得收藏
复制location / {     add_header Access-Control-Allow-Origin *;   add_header Access-Control-Allow-Methods GET,值得收藏 POST, OPTIONS;   add_header Access-Control-Allow-Headers DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization;   if ($request_method = OPTIONS) {    return 204;   }  }  1.2.3.4.5.6.7.8.9.

很赞哦!(3448)