From 4848620594ef96939887cba5aa278b1dc9321efb Mon Sep 17 00:00:00 2001 From: Unknwon Date: Sun, 31 Jan 2016 15:38:20 -0500 Subject: #2229 adjust URL verbose depth for reverse proxy sub-path --- modules/setting/setting.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'modules/setting/setting.go') diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 052ec377..3936546c 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -48,12 +48,13 @@ var ( BuildGitHash string // App settings - AppVer string - AppName string - AppUrl string - AppSubUrl string - AppPath string - AppDataPath = "data" + AppVer string + AppName string + AppUrl string + AppSubUrl string + AppSubUrlDepth int // Number of slashes + AppPath string + AppDataPath = "data" // Server settings Protocol Scheme @@ -299,7 +300,9 @@ func NewContext() { if err != nil { log.Fatal(4, "Invalid ROOT_URL '%s': %s", AppUrl, err) } + // Suburl should start with '/' and end without '/', such as '/{subpath}'. AppSubUrl = strings.TrimSuffix(url.Path, "/") + AppSubUrlDepth = strings.Count(AppSubUrl, "/") Protocol = HTTP if sec.Key("PROTOCOL").String() == "https" { -- cgit v1.2.3