1
0
Fork 0
forked from forgejo/forgejo

Allow Gogs to run from a suburl behind a reverse proxy. e.g. http://mydomain.com/gogs/

Conflicts:
	modules/setting/setting.go

Conflicts:
	templates/repo/release/list.tmpl
	templates/user/dashboard/dashboard.tmpl

Conflicts:
	routers/repo/setting.go
This commit is contained in:
Martin van Beurden 2014-09-14 19:35:22 +02:00
parent 4f74b4e657
commit 0055cbd365
91 changed files with 322 additions and 300 deletions

View file

@ -6,6 +6,7 @@ package setting
import (
"fmt"
"net/url"
"os"
"os/exec"
"path"
@ -31,9 +32,10 @@ const (
var (
// App settings.
AppVer string
AppName string
AppUrl string
AppVer string
AppName string
AppUrl string
AppRootSubUrl string
// Server settings.
Protocol Scheme
@ -165,6 +167,12 @@ func NewConfigContext() {
AppUrl += "/"
}
url, err := url.Parse(AppUrl)
if err != nil {
log.Fatal(4, "Invalid ROOT_URL %s: %s", AppUrl, err)
}
AppRootSubUrl = strings.TrimSuffix(url.Path, "/")
Protocol = HTTP
if Cfg.MustValue("server", "PROTOCOL") == "https" {
Protocol = HTTPS