nginx配置跨域

nginx,server或location段添加:

add_header Access-Control-Allow-Origin '*';
add_header Access-Control-Allow-Credentials "true";
add_header Access-Control-Allow-Methods '*';
add_header Access-Control-Allow-Headers  '*';

if ($request_method = 'OPTIONS') {
    return 200;
}

 

posted @ 2023-02-16 12:40  河在谈  阅读(33)  评论(0编辑  收藏  举报