diff --git a/src/main.go b/src/main.go index 2ec95ec..b47d848 100644 --- a/src/main.go +++ b/src/main.go @@ -55,9 +55,9 @@ var logOutputToFile = flag.Bool("log", true, "Log terminal output to file") var ( name = "Zoraxy" - version = "3.0.7" + version = "3.0.8" nodeUUID = "generic" - development = false //Set this to false to use embedded web fs + development = true //Set this to false to use embedded web fs bootTime = time.Now().Unix() /* diff --git a/src/mod/dynamicproxy/customHeader.go b/src/mod/dynamicproxy/customHeader.go index 93c8a98..f33c143 100644 --- a/src/mod/dynamicproxy/customHeader.go +++ b/src/mod/dynamicproxy/customHeader.go @@ -51,7 +51,13 @@ func (ept *ProxyEndpoint) SplitInboundOutboundHeaders() ([][]string, [][]string) //Check if the endpoint require HSTS headers if ept.HSTSMaxAge > 0 { - downstreamHeaders[downstreamHeaderCounter] = []string{"Strict-Transport-Security", "max-age=" + strconv.Itoa(int(ept.HSTSMaxAge))} + if ept.ContainsWildcardName(true) { + //Endpoint listening domain includes wildcards. + downstreamHeaders[downstreamHeaderCounter] = []string{"Strict-Transport-Security", "max-age=" + strconv.Itoa(int(ept.HSTSMaxAge)) + "; includeSubdomains"} + } else { + downstreamHeaders[downstreamHeaderCounter] = []string{"Strict-Transport-Security", "max-age=" + strconv.Itoa(int(ept.HSTSMaxAge))} + } + downstreamHeaderCounter++ } diff --git a/src/mod/dynamicproxy/endpoints.go b/src/mod/dynamicproxy/endpoints.go index 0cc7b70..4ab4812 100644 --- a/src/mod/dynamicproxy/endpoints.go +++ b/src/mod/dynamicproxy/endpoints.go @@ -133,6 +133,30 @@ func (ep *ProxyEndpoint) AddVirtualDirectoryRule(vdir *VirtualDirectoryEndpoint) return readyRoutingRule, nil } +// Check if the proxy endpoint hostname or alias name contains subdomain wildcard +func (ep *ProxyEndpoint) ContainsWildcardName(skipAliasCheck bool) bool { + hostname := ep.RootOrMatchingDomain + aliasHostnames := ep.MatchingDomainAlias + + wildcardCheck := func(hostname string) bool { + return len(hostname) > 0 && hostname[0] == '*' + } + + if wildcardCheck(hostname) { + return true + } + + if !skipAliasCheck { + for _, aliasHostname := range aliasHostnames { + if wildcardCheck(aliasHostname) { + return true + } + } + } + + return false +} + // Create a deep clone object of the proxy endpoint // Note the returned object is not activated. Call to prepare function before pushing into runtime func (ep *ProxyEndpoint) Clone() *ProxyEndpoint { diff --git a/src/reverseproxy.go b/src/reverseproxy.go index 2292ab9..9d7bea8 100644 --- a/src/reverseproxy.go +++ b/src/reverseproxy.go @@ -475,9 +475,12 @@ func ReverseProxyHandleEditEndpoint(w http.ResponseWriter, r *http.Request) { utils.SendErrorResponse(w, "invalid rate limit number") return } - if proxyRateLimit <= 0 { + + if requireRateLimit && proxyRateLimit <= 0 { utils.SendErrorResponse(w, "rate limit number must be greater than 0") return + }else if proxyRateLimit < 0 { + proxyRateLimit = 1000 } // Bypass WebSocket Origin Check diff --git a/src/web/snippet/customHeaders.html b/src/web/snippet/customHeaders.html index 450243d..127f38b 100644 --- a/src/web/snippet/customHeaders.html +++ b/src/web/snippet/customHeaders.html @@ -51,8 +51,8 @@

- Sent additional custom headers to origin server
- Inject custom headers into origin server responses + Add or remove headers before sending to origin server
+ Modify headers from origin server responses before sending to client

Edit Custom Header