diff --git a/common/site.go b/common/site.go index bf5956a6..5d6d15e7 100644 --- a/common/site.go +++ b/common/site.go @@ -93,6 +93,7 @@ type config struct { DisableJSAntispam bool //LooseCSP bool LooseHost bool + LoosePort bool DisableServerPush bool EnableCDNPush bool diff --git a/docs/configuration.md b/docs/configuration.md index 3a509c4f..58ec7c89 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -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. diff --git a/gen_router.go b/gen_router.go index 43564b8f..0003f6d9 100644 --- a/gen_router.go +++ b/gen_router.go @@ -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 } diff --git a/router_gen/main.go b/router_gen/main.go index cd238e46..d824cf90 100644 --- a/router_gen/main.go +++ b/router_gen/main.go @@ -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 }