Added the LoosePort config.json setting.

This commit is contained in:
Azareal 2019-04-14 10:28:42 +10:00
parent 8bfd5adbbb
commit a7e396cbc2
4 changed files with 5 additions and 2 deletions

View File

@ -93,6 +93,7 @@ type config struct {
DisableJSAntispam bool
//LooseCSP bool
LooseHost bool
LoosePort bool
DisableServerPush bool
EnableCDNPush bool

View File

@ -86,6 +86,8 @@ DisableJSAntispam - This switch lets you disable the JS anti-spam feature. It ma
LooseHost - Disable host header checks in the router. May be useful when using a reverse-proxy like Nginx.
LoosePort - Disable port match checks in the router. May be useful when using a revere-proxy like Nginx.
DisableServerPush - This switch lets you disable the HTTP/2 server push feature.
EnableCDNPush - This switch lets you enable the HTTP/2 CDN Server Push feature. This operates by sending a Link header on every request and may also work with reverse-proxies like Nginx for doing HTTP/2 server pushes.

View File

@ -733,7 +733,7 @@ func (r *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
}
}
// TODO: Reject requests from non-local IPs, if the site host is set to localhost or a localhost IP
if common.Site.PortInt != 80 && common.Site.PortInt != 443 && sport != common.Site.Port {
if !common.Config.LoosePort && common.Site.PortInt != 80 && common.Site.PortInt != 443 && sport != common.Site.Port {
malformedRequest(2)
return
}

View File

@ -512,7 +512,7 @@ func (r *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
}
}
// TODO: Reject requests from non-local IPs, if the site host is set to localhost or a localhost IP
if common.Site.PortInt != 80 && common.Site.PortInt != 443 && sport != common.Site.Port {
if !common.Config.LoosePort && common.Site.PortInt != 80 && common.Site.PortInt != 443 && sport != common.Site.Port {
malformedRequest(2)
return
}