From 09026a606bcc73c08de50d8da11c03502be3674f Mon Sep 17 00:00:00 2001 From: mh-swift Date: Tue, 30 Jul 2024 18:35:10 +0800 Subject: [PATCH] =?UTF-8?q?fix(controller/site):=20=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=8E=A5=E5=8F=A3=E5=9C=A8=E9=9D=9E=E6=B5=8F?= =?UTF-8?q?=E8=A7=88=E5=99=A8=E7=8E=AF=E5=A2=83=E4=B8=AD=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E8=A7=A3=E6=9E=90hostname=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/internal/controller/admin/common/site.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/internal/controller/admin/common/site.go b/server/internal/controller/admin/common/site.go index 7b5c2f9..57bb909 100644 --- a/server/internal/controller/admin/common/site.go +++ b/server/internal/controller/admin/common/site.go @@ -45,7 +45,7 @@ func (c *cSite) Config(ctx context.Context, _ *common.SiteConfigReq) (res *commo func (c *cSite) getWsAddr(ctx context.Context, request *ghttp.Request) string { // 如果是本地IP访问,则认为是调试模式,走实际请求地址,否则走配置中的地址 - ip := ghttp.RequestFromCtx(ctx).GetHeader("hostname") + ip := ghttp.RequestFromCtx(ctx).GetHost() if validate.IsLocalIPAddr(ip) { return "ws://" + ip + ":" + gstr.StrEx(request.Host, ":") + g.Cfg().MustGet(ctx, "router.websocket.prefix").String() } @@ -59,7 +59,7 @@ func (c *cSite) getWsAddr(ctx context.Context, request *ghttp.Request) string { func (c *cSite) getDomain(ctx context.Context, request *ghttp.Request) string { // 如果是本地IP访问,则认为是调试模式,走实际请求地址,否则走配置中的地址 - ip := request.GetHeader("hostname") + ip := request.GetHost() if validate.IsLocalIPAddr(ip) { return "http://" + ip + ":" + gstr.StrEx(request.Host, ":") }