• 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;         }    }

  • 相关阅读:
    转贴:Asp.Net 学习资源列表
    实现简单的写字板
    android绘图—Paint path 旋转
    Eclipse Android编程快捷键
    android Bitmap学习总结
    各种颜色对应的十六进制数
    Android surfaceView 与View 的区别
    SQLite设置_id自增的方法
    数据库表外键设置
    android自定义View的用法
  • 原文地址:https://www.cnblogs.com/lly001/p/10426957.html
Copyright © 2020-2023  润新知