Merge remote-tracking branch 'origin/v2.x' into v2.x
commit
b42ac3c8e6
|
@ -23,7 +23,7 @@ server {
|
||||||
rewrite ^/api/(.*)$ /$1 break; #重写
|
rewrite ^/api/(.*)$ /$1 break; #重写
|
||||||
proxy_pass http://177.8.0.12:8000/; # 设置代理服务器的协议和地址
|
proxy_pass http://177.8.0.12:8000/; # 设置代理服务器的协议和地址
|
||||||
}
|
}
|
||||||
location /ws {
|
location /api/ws {
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-Ip $remote_addr;
|
proxy_set_header X-Real-Ip $remote_addr;
|
||||||
|
|
|
@ -84,15 +84,13 @@ util.wsBaseURL = function () {
|
||||||
baseURL = location.protocol + '//' + location.hostname + (location.port ? ':' : '') + location.port + baseURL
|
baseURL = location.protocol + '//' + location.hostname + (location.port ? ':' : '') + location.port + baseURL
|
||||||
}
|
}
|
||||||
} else if (param !== '' || baseURL.startsWith('/')) {
|
} else if (param !== '' || baseURL.startsWith('/')) {
|
||||||
baseURL = (location.protocol === 'https' ? 'wss://' : 'ws://') + location.hostname + (location.port ? ':' : '') + location.port + baseURL
|
baseURL = (location.protocol === 'https:' ? 'wss://' : 'ws://') + location.hostname + (location.port ? ':' : '') + location.port + baseURL
|
||||||
}
|
}
|
||||||
if (!baseURL.endsWith('/')) {
|
if (!baseURL.endsWith('/')) {
|
||||||
baseURL += '/'
|
baseURL += '/'
|
||||||
}
|
}
|
||||||
if (baseURL.startsWith('http')) {
|
if (baseURL.startsWith('http')) { // https 也默认会被替换成 wss
|
||||||
baseURL = baseURL.replace('http', 'ws')
|
baseURL = baseURL.replace('http', 'ws')
|
||||||
} else if (baseURL.startsWith('https')) {
|
|
||||||
baseURL = baseURL.replace('https', 'wss')
|
|
||||||
}
|
}
|
||||||
return baseURL
|
return baseURL
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue