nginx代理设置请求头

server {
    listen 80;
    server_name  prejoin.*****.com; #监听的hostname
    add_header 'Access-Control-Allow-Origin' '*';
    root   /usr/local/nginx/html; #第一个项目的根目录
    add_header 'Access-Control-Allow-Credentials' 'true';
    add_header 'Access-Control-Allow-Methods' 'OPTION, POST, GET';
    add_header 'Access-Control-Allow-Headers' 'X-Requested-With, Content-Type';
    index index.html;
    location / {
        try_files $uri $uri/ /index.html;
        proxy_set_header Host $host;
        }

    charset utf-8;
    location ~* /join {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header AA ddddd;
        proxy_pass 域名;
    }
}

 

posted @ 2023-11-20 13:02  酷酷的城池  阅读(734)  评论(0编辑  收藏  举报