http: add "Use reverse proxy host" option

added "Use reverse-proxy reported "Host" when possible" option, which
will prefer using the "Host" or "X-Forwarded-Host" values instead of
"External jfa-go URL" in the web app. To do so, app.ExternalDomain/URI
are now functions which take *gin.Context (the latter optionally). The
protocol for the request is determined from X-Forwarded-Proto(col), so
make sure your proxy includes it.

The wiki will have been updated to mention the new option.
This commit is contained in:
Harvey Tindall
2025-07-16 15:00:46 +01:00
parent 41ddf73e4f
commit 7cb66e26e5
9 changed files with 69 additions and 29 deletions

View File

@@ -30,7 +30,7 @@ func (app *appContext) GenInternalReset(userID string) (InternalPWR, error) {
// GenResetLink generates and returns a password reset link.
func (app *appContext) GenResetLink(pin string) (string, error) {
url := app.ExternalURI
url := app.ExternalURI(nil)
var pinLink string
if url == "" {
return pinLink, errors.New(lm.NoExternalHost)