zoukankan      html  css  js  c++  java
  • 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;         }    }

  • 相关阅读:
    Linux pmap 工具
    bzoj 1060 贪心
    bzoj 1076 状压DP
    bzoj 1150 贪心
    bzoj 1412 最小割 网络流
    bzoj 3212 线段树
    bzoj 1942 斜率优化DP
    bzoj 1876 高精
    bzoj 1880 最短路
    斜率优化DP讲解
  • 原文地址:https://www.cnblogs.com/lly001/p/10426957.html
Copyright © 2011-2022 走看看