Nginx 做转发解决跨域问题
server {
listen 80;
listen 443 ssl;
server_name alidphoto22.testaisegment.com testaisegment.aisegment.com;
client_max_body_size 512m;
# ssl on;
ssl_certificate /app/certs/aisegment.com/current/aisegment.com.crt;
ssl_certificate_key /app/certs/aisegment.com/current/aisegment.com.key;
location / {
# 做转发到百度
proxy_pass https://www.baidu.com;
proxy_redirect off;
# proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#解决跨域
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept, Authorization";
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS";
}
}