summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorMike Fellows <Mike.Fellows@shaw.ca>2017-12-25 17:23:43 -0500
committerKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2017-12-25 23:23:43 +0100
commitfabf3f2fc29e143dabefd504cda78d3f47807d2c (patch)
treeb808f7056694f556d203d9223fd2d72a5ba1860c /modules
parentf5155b99136b6e19ab494a97adfcee1810a3d5e7 (diff)
downloadgitea-fabf3f2fc29e143dabefd504cda78d3f47807d2c.tar.gz
gitea-fabf3f2fc29e143dabefd504cda78d3f47807d2c.zip
Add an option to allow redirect of http port 80 to https. (#1928)
* Add an option to allow redirect of http port 80 to https. This is an "opt in" option (default is to not redirect). It will only redirect if protocol is https and the new REDIRECT_PORT_80 option is set to true. The Port to redirect in previous commit was hardcoded to 80, now it can be specified in the app.ini, defaulting to 80. The boolean option to turn redirection on has been changed to REDIRECT_OTHER_PORT to be logically consistent with the new port option. Signed-off-by: Mike Fellows <mike.fellows@shaw.ca>
Diffstat (limited to 'modules')
-rw-r--r--modules/setting/setting.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 5876662270..848cdff640 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -96,6 +96,8 @@ var (
HTTPAddr string
HTTPPort string
LocalURL string
+ RedirectOtherPort bool
+ PortToRedirect string
OfflineMode bool
DisableRouterLog bool
CertFile string
@@ -741,6 +743,8 @@ func NewContext() {
defaultLocalURL += ":" + HTTPPort + "/"
}
LocalURL = sec.Key("LOCAL_ROOT_URL").MustString(defaultLocalURL)
+ RedirectOtherPort = sec.Key("REDIRECT_OTHER_PORT").MustBool(false)
+ PortToRedirect = sec.Key("PORT_TO_REDIRECT").MustString("80")
OfflineMode = sec.Key("OFFLINE_MODE").MustBool()
DisableRouterLog = sec.Key("DISABLE_ROUTER_LOG").MustBool()
StaticRootPath = sec.Key("STATIC_ROOT_PATH").MustString(AppWorkPath)