2020-11-19 01:50:34 +00:00
|
|
|
package server
|
|
|
|
|
2022-07-25 10:43:50 +00:00
|
|
|
import (
|
|
|
|
"github.com/valyala/fasthttp"
|
|
|
|
)
|
|
|
|
|
2021-11-15 08:37:58 +00:00
|
|
|
const (
|
2023-01-03 03:49:02 +00:00
|
|
|
assetsRoot = "public_html"
|
2022-09-16 01:19:16 +00:00
|
|
|
|
2023-01-03 03:49:02 +00:00
|
|
|
fileLogo = "logo.png"
|
2022-12-17 00:49:05 +00:00
|
|
|
|
|
|
|
extHTML = ".html"
|
|
|
|
extJSON = ".json"
|
2023-01-03 03:49:02 +00:00
|
|
|
extYML = ".yml"
|
2021-11-15 08:37:58 +00:00
|
|
|
)
|
|
|
|
|
2022-04-03 23:58:01 +00:00
|
|
|
var (
|
2022-09-16 01:19:16 +00:00
|
|
|
filesRoot = []string{"manifest.json", "robots.txt"}
|
|
|
|
filesSwagger = []string{
|
2022-04-03 23:58:01 +00:00
|
|
|
"favicon-16x16.png",
|
|
|
|
"favicon-32x32.png",
|
|
|
|
"index.css",
|
|
|
|
"oauth2-redirect.html",
|
|
|
|
"swagger-initializer.js",
|
|
|
|
"swagger-ui-bundle.js",
|
|
|
|
"swagger-ui-bundle.js.map",
|
|
|
|
"swagger-ui-es-bundle-core.js",
|
|
|
|
"swagger-ui-es-bundle-core.js.map",
|
|
|
|
"swagger-ui-es-bundle.js",
|
|
|
|
"swagger-ui-es-bundle.js.map",
|
|
|
|
"swagger-ui-standalone-preset.js",
|
|
|
|
"swagger-ui-standalone-preset.js.map",
|
|
|
|
"swagger-ui.css",
|
|
|
|
"swagger-ui.css.map",
|
|
|
|
"swagger-ui.js",
|
|
|
|
"swagger-ui.js.map",
|
|
|
|
}
|
|
|
|
|
|
|
|
// Directories excluded from the not found handler proceeding to the next() handler.
|
2022-09-16 01:19:16 +00:00
|
|
|
dirsHTTPServer = []struct {
|
2022-04-03 23:58:01 +00:00
|
|
|
name, prefix string
|
|
|
|
}{
|
|
|
|
{name: "/api", prefix: "/api/"},
|
|
|
|
{name: "/.well-known", prefix: "/.well-known/"},
|
|
|
|
{name: "/static", prefix: "/static/"},
|
2022-04-07 00:58:51 +00:00
|
|
|
{name: "/locales", prefix: "/locales/"},
|
2022-04-03 23:58:01 +00:00
|
|
|
}
|
|
|
|
)
|
2021-01-03 04:28:46 +00:00
|
|
|
|
2021-12-01 03:32:58 +00:00
|
|
|
const (
|
2022-12-17 00:49:05 +00:00
|
|
|
environment = "ENVIRONMENT"
|
2022-04-07 00:58:51 +00:00
|
|
|
dev = "dev"
|
2023-01-03 03:49:02 +00:00
|
|
|
strFalse = "false"
|
|
|
|
strTrue = "true"
|
2022-04-07 00:58:51 +00:00
|
|
|
localhost = "localhost"
|
|
|
|
schemeHTTP = "http"
|
|
|
|
schemeHTTPS = "https"
|
2021-12-01 03:32:58 +00:00
|
|
|
)
|
2021-08-05 04:02:07 +00:00
|
|
|
|
2022-07-25 10:43:50 +00:00
|
|
|
var (
|
|
|
|
headerETag = []byte(fasthttp.HeaderETag)
|
|
|
|
headerIfNoneMatch = []byte(fasthttp.HeaderIfNoneMatch)
|
|
|
|
headerCacheControl = []byte(fasthttp.HeaderCacheControl)
|
|
|
|
|
|
|
|
headerValueCacheControlETaggedAssets = []byte("public, max-age=0, must-revalidate")
|
|
|
|
)
|
|
|
|
|
2021-08-05 04:02:07 +00:00
|
|
|
const healthCheckEnv = `# Written by Authelia Process
|
|
|
|
X_AUTHELIA_HEALTHCHECK=1
|
|
|
|
X_AUTHELIA_HEALTHCHECK_SCHEME=%s
|
|
|
|
X_AUTHELIA_HEALTHCHECK_HOST=%s
|
|
|
|
X_AUTHELIA_HEALTHCHECK_PORT=%d
|
|
|
|
X_AUTHELIA_HEALTHCHECK_PATH=%s
|
|
|
|
`
|
2022-02-20 23:14:09 +00:00
|
|
|
|
|
|
|
const (
|
2023-01-03 03:49:02 +00:00
|
|
|
tmplCSPSwaggerNonce = "default-src 'self'; img-src 'self' https://validator.swagger.io data:; object-src 'none'; script-src 'self' 'unsafe-inline' 'nonce-%s'; style-src 'self' 'nonce-%s'; base-uri 'self'"
|
|
|
|
tmplCSPSwagger = "default-src 'self'; img-src 'self' https://validator.swagger.io data:; object-src 'none'; script-src 'self' 'unsafe-inline'; style-src 'self'; base-uri 'self'"
|
2022-02-20 23:14:09 +00:00
|
|
|
)
|
2022-08-08 21:50:12 +00:00
|
|
|
|
|
|
|
const (
|
|
|
|
connNonTLS = "non-TLS"
|
|
|
|
connTLS = "TLS"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
fmtLogServerInit = "Initializing %s for %s connections on '%s' path '%s'"
|
|
|
|
)
|