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:
+2
-2
@@ -65,7 +65,7 @@ func (app *appContext) getUserTokenLogin(gc *gin.Context) {
|
||||
}
|
||||
|
||||
// host := gc.Request.URL.Hostname()
|
||||
host := app.ExternalDomain
|
||||
host := app.ExternalDomain(gc)
|
||||
uri := "/my"
|
||||
// FIXME: This seems like a bad idea? I think it's to deal with people having Reverse proxy subfolder/URL base set to /accounts.
|
||||
if strings.HasPrefix(gc.Request.RequestURI, PAGES.Base) {
|
||||
@@ -105,7 +105,7 @@ func (app *appContext) getUserTokenRefresh(gc *gin.Context) {
|
||||
}
|
||||
|
||||
// host := gc.Request.URL.Hostname()
|
||||
host := app.ExternalDomain
|
||||
host := app.ExternalDomain(gc)
|
||||
gc.SetCookie("user-refresh", refresh, REFRESH_TOKEN_VALIDITY_SEC, "/my", host, true, true)
|
||||
gc.JSON(200, getTokenDTO{jwt})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user