ajax 跨域 如果在head里面加了参数需要在 nginx add_header 里面添加

滴滴滴--你不是爱拖延,而是爱逃避 / 2023-08-09 / 原文

server {
    listen 80;
    server_name yourdomain.com;

    location / {
        # 允许跨域请求
        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
        add_header 'Access-Control-Allow-Headers' 'Origin, X-Requested-With, Content-Type, Accept, c-xxxx-id';