mirror of
https://github.com/mjl-/mox.git
synced 2025-07-13 22:14:39 +03:00
for the web interfaces, ensure the effective configured http paths end in a slash to prevent 404's and/or errors accessing the web interfaces
The default paths for the web interfaces, such as /admin/, /account/, /webmail/ and /webapi/ end with a slash. They should end with a slash because we use the path when restricting cookies to just that web interface. You could configure paths not ending with a slash, but due to using http.StripPrefix, and our handler, some of those requests may not work properly. We now warn if configured paths don't end with a trailing slash when parsing the config file. We normally error out when such things happen, but users probably have paths without trailing slashes configured, and we don't want to break them on a future upgrade. We now use an effective path that includes the trailing slash. We would always redirect requests to the configured paths but without trailing slash to the path with trailing slash, and that stays. For issue #325 by odama626.
This commit is contained in:
@ -222,7 +222,7 @@ type Listener struct {
|
||||
type WebService struct {
|
||||
Enabled bool
|
||||
Port int `sconf:"optional" sconf-doc:"Default 80 for HTTP and 443 for HTTPS. See Hostname at Listener for hostname matching behaviour."`
|
||||
Path string `sconf:"optional" sconf-doc:"Path to serve requests on."`
|
||||
Path string `sconf:"optional" sconf-doc:"Path to serve requests on. Should end with a slash, related to cookie paths."`
|
||||
Forwarded bool `sconf:"optional" sconf-doc:"If set, X-Forwarded-* headers are used for the remote IP address for rate limiting and for the \"secure\" status of cookies."`
|
||||
}
|
||||
|
||||
|
@ -333,7 +333,8 @@ See https://pkg.go.dev/github.com/mjl-/sconf for details.
|
||||
# matching behaviour. (optional)
|
||||
Port: 0
|
||||
|
||||
# Path to serve requests on. (optional)
|
||||
# Path to serve requests on. Should end with a slash, related to cookie paths.
|
||||
# (optional)
|
||||
Path:
|
||||
|
||||
# If set, X-Forwarded-* headers are used for the remote IP address for rate
|
||||
@ -349,7 +350,8 @@ See https://pkg.go.dev/github.com/mjl-/sconf for details.
|
||||
# matching behaviour. (optional)
|
||||
Port: 0
|
||||
|
||||
# Path to serve requests on. (optional)
|
||||
# Path to serve requests on. Should end with a slash, related to cookie paths.
|
||||
# (optional)
|
||||
Path:
|
||||
|
||||
# If set, X-Forwarded-* headers are used for the remote IP address for rate
|
||||
@ -368,7 +370,8 @@ See https://pkg.go.dev/github.com/mjl-/sconf for details.
|
||||
# matching behaviour. (optional)
|
||||
Port: 0
|
||||
|
||||
# Path to serve requests on. (optional)
|
||||
# Path to serve requests on. Should end with a slash, related to cookie paths.
|
||||
# (optional)
|
||||
Path:
|
||||
|
||||
# If set, X-Forwarded-* headers are used for the remote IP address for rate
|
||||
@ -384,7 +387,8 @@ See https://pkg.go.dev/github.com/mjl-/sconf for details.
|
||||
# matching behaviour. (optional)
|
||||
Port: 0
|
||||
|
||||
# Path to serve requests on. (optional)
|
||||
# Path to serve requests on. Should end with a slash, related to cookie paths.
|
||||
# (optional)
|
||||
Path:
|
||||
|
||||
# If set, X-Forwarded-* headers are used for the remote IP address for rate
|
||||
@ -399,7 +403,8 @@ See https://pkg.go.dev/github.com/mjl-/sconf for details.
|
||||
# matching behaviour. (optional)
|
||||
Port: 0
|
||||
|
||||
# Path to serve requests on. (optional)
|
||||
# Path to serve requests on. Should end with a slash, related to cookie paths.
|
||||
# (optional)
|
||||
Path:
|
||||
|
||||
# If set, X-Forwarded-* headers are used for the remote IP address for rate
|
||||
@ -415,7 +420,8 @@ See https://pkg.go.dev/github.com/mjl-/sconf for details.
|
||||
# matching behaviour. (optional)
|
||||
Port: 0
|
||||
|
||||
# Path to serve requests on. (optional)
|
||||
# Path to serve requests on. Should end with a slash, related to cookie paths.
|
||||
# (optional)
|
||||
Path:
|
||||
|
||||
# If set, X-Forwarded-* headers are used for the remote IP address for rate
|
||||
@ -430,7 +436,8 @@ See https://pkg.go.dev/github.com/mjl-/sconf for details.
|
||||
# matching behaviour. (optional)
|
||||
Port: 0
|
||||
|
||||
# Path to serve requests on. (optional)
|
||||
# Path to serve requests on. Should end with a slash, related to cookie paths.
|
||||
# (optional)
|
||||
Path:
|
||||
|
||||
# If set, X-Forwarded-* headers are used for the remote IP address for rate
|
||||
@ -446,7 +453,8 @@ See https://pkg.go.dev/github.com/mjl-/sconf for details.
|
||||
# matching behaviour. (optional)
|
||||
Port: 0
|
||||
|
||||
# Path to serve requests on. (optional)
|
||||
# Path to serve requests on. Should end with a slash, related to cookie paths.
|
||||
# (optional)
|
||||
Path:
|
||||
|
||||
# If set, X-Forwarded-* headers are used for the remote IP address for rate
|
||||
|
Reference in New Issue
Block a user