1.前端代理跨域:
proxy: {
'/adapter': {
target: 'http://172.21.35.5:9090/',
changeOrigin: true,
ws: true,
// xfwd: true
pathRewrite: {
'^/adapter': ''
}
},
'/firewall': {
target: 'http://172.21.35.233:4080/api/',
changeOrigin: true,
ws: true,
// xfwd: true
pathRewrite: {
'^/firewall': ''
}
}
}
2. Nginx代理配置
location ^~ /firewall/ {
proxy_pass http://172.21.35.233:4080/api/;
proxy_send_timeout 1800;
proxy_read_timeout 1800;
proxy_connect_timeout 1800;
client_max_body_size 2048m;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header accept-encodeing 'gzip, deflate';
proxy_set_header content-type 'application/json';
proxy_set_header authorization $http_authorization;
proxy_set_header accept '*/*';
proxy_set_header x-bce-date $http_x_bce_date;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}