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

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

 

posted @ 2023-08-09 16:57  滴滴滴  阅读(26)  评论(0编辑  收藏  举报