zoukankan      html  css  js  c++  java
  • 调试允许跨站请求

    2018-11-12 13:34:12

    调试允许跨站请求

    A站:http://127.0.0.1:35585
    B站:http://192.168.58.228

    A站请求:
    $.getJson("http://192.168.58.228/api/api.php", function(res){ ... });

    B站响应头需加入:
    Access-Control-Allow-Origin: *
    Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Referer, User-Agent, Authorization, X-Auth-Token
    Access-Control-Allow-Credentials: true

    如果B用APACHE,可以在httpd.conf尾加入:

    Header always set Access-Control-Allow-Origin "*"
    Header always set Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept, Referer, User-Agent, Authorization, X-Auth-Token"
    Header always set Access-Control-Allow-Credentials "true"

  • 相关阅读:
    woj 1574
    UESTC 594 我要长高 dp单调队列
    HDU 3401 Trade dp 单调队列优化
    HDU 2844 Coins 多重背包
    2-1
    1-2
    1-1
    12-1
    9-1
    14-8
  • 原文地址:https://www.cnblogs.com/mull/p/9946553.html
Copyright © 2011-2022 走看看