diff --git a/net/ghttp/ghttp_server_swagger.go b/net/ghttp/ghttp_server_swagger.go index 5071a72b6cf..9f67f3758ee 100644 --- a/net/ghttp/ghttp_server_swagger.go +++ b/net/ghttp/ghttp_server_swagger.go @@ -47,7 +47,7 @@ func (s *Server) swaggerUI(r *Request) { if r.StaticFile != nil && r.StaticFile.File != nil && r.StaticFile.IsDir { content := gstr.ReplaceByMap(swaggerUITemplate, map[string]string{ swaggerUIDocURLPlaceHolder: s.config.OpenApiPath, - swaggerUIDocNamePlaceHolder: gstr.TrimRight(fmt.Sprintf(`//%s%s`, r.Host, r.URL.String()), "/") + "/" + swaggerUIDocName, + swaggerUIDocNamePlaceHolder: gstr.TrimRight(fmt.Sprintf(`//%s%s`, r.Host, r.Server.config.SwaggerPath), "/") + "/" + swaggerUIDocName, }) r.Response.Write(content) r.ExitAll()