summaryrefslogtreecommitdiff
path: root/internal/middlewares/const.go
diff options
context:
space:
mode:
authorJames Elliott <james-d-elliott@users.noreply.github.com>2022-02-07 00:37:28 +1100
committerGitHub <noreply@github.com>2022-02-07 00:37:28 +1100
commit26236f491e6d2b16ae2bc8297e33a9dc883f44e5 (patch)
tree4eee1e5ee3744ce6e929a9c848ee5c056009c8d7 /internal/middlewares/const.go
parent7775d2af0e18d822c4e02c6ae53ee1dea0feb5de (diff)
fix(server): use of inconsistent methods for determining origin (#2848)
This unifies the methods to obtain the X-Forwarded-* header values and provides logical fallbacks. In addition, so we can ensure this functionality extends to the templated files we've converted the ServeTemplatedFile method into a function that operates as a middlewares.RequestHandler. Fixes #2765
Diffstat (limited to 'internal/middlewares/const.go')
-rw-r--r--internal/middlewares/const.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/internal/middlewares/const.go b/internal/middlewares/const.go
index 01fc3f1e1..dbe37e6f5 100644
--- a/internal/middlewares/const.go
+++ b/internal/middlewares/const.go
@@ -14,6 +14,12 @@ var (
headerXForwardedURI = []byte("X-Forwarded-URI")
headerXOriginalURL = []byte("X-Original-URL")
headerXForwardedMethod = []byte("X-Forwarded-Method")
+
+ protoHTTPS = []byte("https")
+ protoHTTP = []byte("http")
+
+ // UserValueKeyBaseURL is the User Value key where we store the Base URL.
+ UserValueKeyBaseURL = []byte("base_url")
)
const (