Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

Fix BaseURL when hosted behind a TLS reverse proxy (#254)

Kevin Poirotf3485f9cd684
diff --git a/app/pkg/web/context.go b/app/pkg/web/context.go
index 11db6483d..8f11bd42b 100644
--- a/app/pkg/web/context.go
+++ b/app/pkg/web/context.go
@@ -266,7 +266,7 @@ func (ctx *Context) ActiveTransaction() *dbx.Trx {
//BaseURL returns base URL as string
func (ctx *Context) BaseURL() string {
protocol := "http"
- if ctx.Request.TLS != nil {
+ if ctx.Request.TLS != nil || ctx.Request.Header.Get("X-Forwarded-Proto") == "https" {
protocol = "https"
}
return protocol + "://" + ctx.Request.Host