Solve cross-domain problems through nginx configuration

Solve cross-domain problems through nginx configuration

    # 测试 nginx的跨域问题
    location /testNginx {

        #允许跨域请求的域,* 表示所有
        add_header 'Access-Control-Allow-Origin' *;
        #允许携有cookie请求
        add_header 'Access-Control-Allow-Credentials' 'true';
        #允许请求方式,比如 GET/POST/PUT/DELETE
        add_header 'Access-Control-Allow-Methods' *;
        #允许请求的header
        add_header 'Access-Control-Allow-Headers' *;
        proxy_pass http://127.0.0.1:9999;   // 
    }

Guess you like

Origin blog.csdn.net/qq_51134950/article/details/126068560