server { listen 80; server_name www.zhishixun.com www.nneye.cn; client_max_body_size 50m; location / { root html/iFLIP.com/; index index.html index.htm; try_files $uri $uri/ /index.html; } location /api/ { proxy_pass http://iflip/; # 转发到后端服务 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-Methods' 'GET,POST,PUT,DELETE,OPTIONS,HEAD'; add_header 'Access-Control-Allow-Headers' '*'; add_header 'Access-Control-Expose-Headers' '*'; } } 使用 域名 www.nneye.cn 访问,接口调用www.zhishixun.com/api 出现跨域怎么解决
理解问题server { listen 80; server_name www.zhishixun.com www.nneye.cn; client_max_body_size 50m; location / { root html/iFLIP.com/; index index.html index.htm; try_files $uri $uri/ /index.html; } location /api/ { proxy_pass http://iflip/; # 转发到后端服务 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-Methods' 'GET,POST,PUT,DELETE,OPTIONS,HEAD'; add_header 'Access-Control-Allow-Headers' '*'; add_header 'Access-Control-Expose-Headers' '*'; } } 使用 域名 www.nneye.cn 访问,接口调用www.zhishixun.com/api 出现跨域怎么解决
已完成理解「server { listen 80; server_name www.zhishixun.com www.nneye.cn; client_max_body_size 50m; location / { root html/iFLIP.com/; index index.html index.htm; try_files $uri $uri/ /index.html; } location /api/ { proxy_pass http://iflip/; # 转发到后端服务 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-Methods' 'GET,POST,PUT,DELETE,OPTIONS,HEAD'; add_header 'Access-Control-Allow-Headers' '*'; add_header 'Access-Control-Expose-Headers' '*'; } } 使用 域名 www.nneye.cn 访问,接口调用www.zhishixun.com/api 出现跨域怎么解决」
展开阅读网页