Implement HTTP-only mode

This is very useful for reserve proxies
in cases when TLS passthrough is not desired.
This commit is contained in:
JCM
2024-05-23 12:07:32 +02:00
parent 69361c69c1
commit ec3af84174
6 changed files with 63 additions and 40 deletions

View File

@ -9,6 +9,7 @@ mainDomain = 'codeberg.page'
rawDomain = 'raw.codeberg.page'
allowedCorsDomains = ['fonts.codeberg.org', 'design.codeberg.org']
blacklistedPaths = ['do/not/use']
httpOnlyMode = false
[gitea]
root = 'codeberg.org'

View File

@ -18,6 +18,7 @@ type ServerConfig struct {
PagesBranches []string
AllowedCorsDomains []string
BlacklistedPaths []string
HttpOnlyMode bool `default:"false"`
}
type GiteaConfig struct {

View File

@ -84,6 +84,9 @@ func mergeServerConfig(ctx *cli.Context, config *ServerConfig) {
if ctx.IsSet("blacklisted-paths") {
config.BlacklistedPaths = ctx.StringSlice("blacklisted-paths")
}
if ctx.IsSet("http-only-mode") {
config.HttpOnlyMode = ctx.Bool("http-only-mode")
}
// add the paths that should always be blacklisted
config.BlacklistedPaths = append(config.BlacklistedPaths, ALWAYS_BLACKLISTED_PATHS...)