Merge pull request #140 from yokowu/fix-base-url

fix: 修复baseurl端口问题
This commit is contained in:
Yoko
2025-07-24 16:51:31 +08:00
committed by GitHub

View File

@@ -83,7 +83,11 @@ func (c *Config) GetBaseURL(req *http.Request) string {
if proto := req.Header.Get("X-Forwarded-Proto"); proto != "" {
scheme = proto
}
return fmt.Sprintf("%s://%s:%s", scheme, req.Host, c.Server.Port)
baseurl := fmt.Sprintf("%s://%s", scheme, req.Host)
if c.Server.Port != "" {
baseurl = fmt.Sprintf("%s:%s", baseurl, c.Server.Port)
}
return baseurl
}
func Init() (*Config, error) {