From 9d3e926256102e7dfd18038c56509549245602ac Mon Sep 17 00:00:00 2001 From: 5high <5high.net@gmail.com> Date: Wed, 11 Jan 2023 10:08:42 +0800 Subject: [PATCH] Update https.go --- server/proxy/https.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/proxy/https.go b/server/proxy/https.go index 86e15687..596bf816 100644 --- a/server/proxy/https.go +++ b/server/proxy/https.go @@ -4,6 +4,7 @@ import ( "net" "net/http" "net/url" + "path/filepath" "sync" "ehang.io/nps/lib/cache" @@ -34,6 +35,10 @@ func NewHttpsServer(l net.Listener, bridge NetBridge, useCache bool, cacheLen in //start https server func (https *HttpsServer) Start() error { + var err error + if https.errorContent, err = common.ReadAllFromFile(filepath.Join(common.GetRunPath(), "web", "static", "page", "error.html")); err != nil { + https.errorContent = []byte("nps 404") + } if b, err := beego.AppConfig.Bool("https_just_proxy"); err == nil && b { conn.Accept(https.listener, func(c net.Conn) { https.handleHttps(c)