🎨 桌面端内核进程使用随机端口 https://github.com/siyuan-note/siyuan/issues/4952
This commit is contained in:
parent
14dcf78cd9
commit
1a48947e39
1 changed files with 2 additions and 0 deletions
|
@ -107,12 +107,14 @@ func Serve(fastMode bool) {
|
|||
|
||||
go func() {
|
||||
if util.FixedPort != port {
|
||||
// 启动一个 6806 端口的反向代理服务器,这样浏览器扩展才能直接使用 127.0.0.1:6806,不用配置端口
|
||||
serverURL, _ := url.Parse("http://" + host + ":" + port)
|
||||
proxy := httputil.NewSingleHostReverseProxy(serverURL)
|
||||
logging.LogInfof("kernel reverse proxy server [%s] is booting", util.FixedPort)
|
||||
if proxyErr := http.ListenAndServe(host+":"+util.FixedPort, proxy); nil != proxyErr {
|
||||
logging.LogErrorf("boot kernel reverse proxy server failed: %s", serverURL, proxyErr)
|
||||
}
|
||||
// 反代服务器启动失败不影响核心服务器启动
|
||||
}
|
||||
}()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue