Nginx 跨域

location ^~ /aiImage/ {

      

      # 开启允许跨域访问

      add_header Access-Control-Allow-Origin '*';

      # add_header Access-Control-Allow-Credentials 'true';

      # add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';

      # alias /www/wwwroot/demo.suiruo.net/server/public/aiImage/;

      

    #   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;

    # }

      # return 701 '{"id":1,"name":"TOM","age":18}';

      

    }

被以下专题收入,发现更多相似内容
Nginx
推荐阅读更多精彩内容