summaryrefslogtreecommitdiffstats
path: root/modules/middleware/auth.go
diff options
context:
space:
mode:
authorMartin van Beurden <chadoe@gmail.com>2014-09-14 19:35:22 +0200
committerMartin van Beurden <chadoe@gmail.com>2014-09-18 20:50:48 +0200
commit0055cbd3651ebde0f8b6cc70c9c44de56dc38830 (patch)
tree64a9ea617ba1f704139881c3960fa2425dad9018 /modules/middleware/auth.go
parent4f74b4e6578be4251af65cd08daa37c884e431a0 (diff)
downloadgitea-0055cbd3651ebde0f8b6cc70c9c44de56dc38830.tar.gz
gitea-0055cbd3651ebde0f8b6cc70c9c44de56dc38830.zip
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
Diffstat (limited to 'modules/middleware/auth.go')
-rw-r--r--modules/middleware/auth.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/middleware/auth.go b/modules/middleware/auth.go
index 51ce48c69b..ccd8d0315d 100644
--- a/modules/middleware/auth.go
+++ b/modules/middleware/auth.go
@@ -25,13 +25,13 @@ func Toggle(options *ToggleOptions) macaron.Handler {
return func(ctx *Context) {
// Cannot view any page before installation.
if !setting.InstallLock {
- ctx.Redirect("/install")
+ ctx.Redirect(setting.AppRootSubUrl + "/install")
return
}
// Redirect to dashboard if user tries to visit any non-login page.
if options.SignOutRequire && ctx.IsSigned && ctx.Req.RequestURI != "/" {
- ctx.Redirect("/")
+ ctx.Redirect(setting.AppRootSubUrl + "/")
return
}
@@ -48,8 +48,8 @@ func Toggle(options *ToggleOptions) macaron.Handler {
if strings.HasSuffix(ctx.Req.RequestURI, "watch") {
return
}
- ctx.SetCookie("redirect_to", "/"+url.QueryEscape(ctx.Req.RequestURI))
- ctx.Redirect("/user/login")
+ ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppRootSubUrl + ctx.Req.RequestURI))
+ ctx.Redirect(setting.AppRootSubUrl + "/user/login")
return
} else if !ctx.User.IsActive && setting.Service.RegisterEmailConfirm {
ctx.Data["Title"] = ctx.Tr("auth.active_your_account")