xds: fix misdirected script (#1895)

This commit is contained in:
Caleb Doxsey 2021-02-16 14:57:21 -07:00 committed by GitHub
parent 51be8ffd76
commit 5be71b8e07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View file

@ -14,10 +14,11 @@ function envoy_on_response(response_handle)
local authority =
dynamic_meta:get("envoy.filters.http.lua")["request.authority"]
local expected_authority = "%s"
-- if we got a 404 (no route found) and the authority header doens't match
-- if we got a 404 (no route found) and the authority header doesn't match
-- assume we've coalesced http/2 connections and return a 421
if headers:get(":status") == "404" and authority ~= "%s" then
if headers:get(":status") == "404" and authority ~= expected_authority then
headers:replace(":status", "421")
end
end

File diff suppressed because one or more lines are too long

View file

@ -312,7 +312,7 @@ func (srv *Server) buildMainHTTPConnectionManagerFilter(
}
if tlsDomain != "" && tlsDomain != "*" {
fixMisdirectedLua := marshalAny(&envoy_extensions_filters_http_lua_v3.Lua{
InlineCode: fmt.Sprintf(luascripts.FixMisdirected),
InlineCode: fmt.Sprintf(luascripts.FixMisdirected, tlsDomain),
})
filters = append(filters, &envoy_http_connection_manager.HttpFilter{
Name: "envoy.filters.http.lua",