Nginx 反向代理后浏览器不能获取响应

Nginx 反向代理后浏览器不能获取响应

配置如下

		location ^~/m-service/ {
     
			proxy_set_header userType 2;#0 任意用户,1普通用户,2管理员
			proxy_set_header userName admin_test;# 用户名
			proxy_set_header Host  $http_host;
            proxy_set_header Cookie $http_cookie;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_pass http://10.8.31.216:6003/;
        }

修改为

		location ^~/m-service/ {
     
			proxy_set_header userType 2;#0 任意用户,1普通用户,2管理员
			proxy_set_header userName admin_test;# 用户名
			proxy_set_header Host  $http_host;
            proxy_set_header Cookie $http_cookie;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
			add_header 'Access-Control-Allow-Origin' '*';  
			add_header 'Access-Control-Allow-Credentials' 'true'; 
            proxy_pass http://10.8.31.216:6003/;
        }

你可能感兴趣的:(java,nginx)