mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
26236f491e
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
41 lines
1.3 KiB
Go
41 lines
1.3 KiB
Go
package middlewares
|
|
|
|
import (
|
|
"github.com/valyala/fasthttp"
|
|
)
|
|
|
|
var (
|
|
headerXForwardedProto = []byte(fasthttp.HeaderXForwardedProto)
|
|
headerXForwardedHost = []byte(fasthttp.HeaderXForwardedHost)
|
|
headerXForwardedFor = []byte(fasthttp.HeaderXForwardedFor)
|
|
headerXRequestedWith = []byte(fasthttp.HeaderXRequestedWith)
|
|
headerAccept = []byte(fasthttp.HeaderAccept)
|
|
|
|
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 (
|
|
headerValueXRequestedWithXHR = "XMLHttpRequest"
|
|
contentTypeApplicationJSON = "application/json"
|
|
contentTypeTextHTML = "text/html"
|
|
)
|
|
|
|
var okMessageBytes = []byte("{\"status\":\"OK\"}")
|
|
|
|
const (
|
|
messageOperationFailed = "Operation failed"
|
|
messageIdentityVerificationTokenAlreadyUsed = "The identity verification token has already been used"
|
|
messageIdentityVerificationTokenHasExpired = "The identity verification token has expired"
|
|
)
|
|
|
|
var protoHostSeparator = []byte("://")
|
|
var validOverrideAssets = []string{"favicon.ico", "logo.png"}
|