nginx反向代理ajax,解决跨域问题
server {
listen 8000;
server_name somename alias another.alias;
location /a {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
add_header 'Access-Control-Expose-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
add_header 'Access-Control-Allow-Credentials' 'true';
proxy_redirect off; proxy_pass https://www.oschina.net/news/widgets/_news_index_all_list?p=2&type=ajax;
}
}
server { listen 8000; server_name somename alias another.alias; location /a { add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; add_header 'Access-Control-Expose-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';add_header 'Access-Control-Allow-Credentials' 'true'; proxy_redirect off; proxy_pass https://www.oschina.net/news/widgets/_news_index_all_list?p=2&type=ajax; } }
最新文章
- Bootstrap WPF Style,Bootstrap风格的WPF样式
- PHP程序员的技术成长规划
- setAttribute,,,getAttribute,,,,
- asp.net解决高并发的方案.[转]
- Flume1.5.0的安装、部署、简单应用(含伪分布式、与hadoop2.2.0、hbase0.96的案例)
- SIFT算法详解(转)
- CodeForces 471C MUH and House of Cards
- JavaScript数据结构——栈和队列
- hdu 2516(斐波拉切博弈)
- webSphere提示SSL证书过期,解决方法
- C#中的预处理器指令
- [codevs]失恋28天题目系列
- PHP要注意的14个问题
- MySQL:Error : Tablespace for table '`database`.`temp`' exists. Please DISCARD the tablespace before IMPORT.解决办法
- WebService两种调用方法
- 教你如何用 lib-flexible 实现移动端H5页面适配
- input子系统学习笔记六 按键驱动实例分析下【转】
- Java语言基础问题
- aps.net webform框架下页面服务器端控件和html控件用法
- oracle安装后sqlnet.ora文件