Commit c1a8daa6 authored by 杨培's avatar 杨培

优化 api 对跨域策略的判断

parent 1e22ba1e
/**
* Created by pader on 2017/6/14.
*/
var headerAuthorize = __BASE_URL__ == __SERVER_URL__;
//Web端与Server端根网址一致则采用 header 授权方案
var serverParse = __SERVER_URL__.match(/^(https?:)?(\/\/[\w\.\-:]+)\//);
var serverOrigin = (serverParse[1] ? serverParse[1] : location.protocol) + serverParse[2];
var headerAuthorize = location.origin == serverOrigin;
function getUrl(uri) {
return __SERVER_URL__ + uri;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment