mirror of
https://github.com/mjl-/mox.git
synced 2024-12-26 08:23:48 +03:00
if webauth login cookie is missing, and forwarding was configured, hint that reverse proxy may be stripping path
the cookies are set with a specific path, because the webadmin, webaccount and webmail cookies can be on the same domain (this is the default). if the reverse proxy strips the path while forwarding, the browser won't set the cookie and the login attempt will fail. based on github issue #151 from naturalethic
This commit is contained in:
parent
daa88480cb
commit
afc47c8108
1 changed files with 5 additions and 1 deletions
|
@ -227,7 +227,11 @@ func LoginPrep(ctx context.Context, log mlog.Log, kind, cookiePath string, isFor
|
|||
func Login(ctx context.Context, log mlog.Log, sessionAuth SessionAuth, kind, cookiePath string, isForwarded bool, w http.ResponseWriter, r *http.Request, loginToken, username, password string) (store.CSRFToken, error) {
|
||||
loginCookie, _ := r.Cookie(kind + "login")
|
||||
if loginCookie == nil || loginCookie.Value != loginToken {
|
||||
return "", &sherpa.Error{Code: "user:error", Message: "missing login token"}
|
||||
msg := "missing login token cookie"
|
||||
if isForwarded && loginCookie == nil {
|
||||
msg += " (hint: reverse proxy must keep path, for login cookie)"
|
||||
}
|
||||
return "", &sherpa.Error{Code: "user:error", Message: msg}
|
||||
}
|
||||
|
||||
ip := RemoteIP(log, isForwarded, r)
|
||||
|
|
Loading…
Reference in a new issue