I need to decrypt the body of a request in an external API.But, when I try to do it with an EnvoyFilter using lua it doesn't work.If I try the same code that I'm posting here, but without HTTPS, works. But with HTTPS returns 503.
apiVersion: networking.istio.io/v1alpha3kind: EnvoyFiltermetadata: name: eva-decrypt-filter namespace: istio-systemspec: configPatches: - applyTo: HTTP_FILTER match: context: ANY listener: filterChain: filter: name: "envoy.filters.network.http_connection_manager" patch: operation: INSERT_BEFORE value: name: envoy.lua typed_config:"@type": "type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua" inlineCode: | function envoy_on_request(request_handle) local buffered = request_handle:body() local bodyString = tostring(buffered:getBytes(0, buffered:length())) print("bodyString ->") print(bodyString) if string.match(bodyString, "valcirtest") then print("iniciando http_Call") local responseHeaders, responseBody = request_handle:httpCall("thirdparty", { [":method"] = "POST", [":path"] = "/decrypt", [":authority"] = "keycloack-dev-admin.eva.bot", [":scheme"] = "https", ["content-type"] = "application/json", ["content-length"] = bodyString:len(), }, bodyString, 3000) print("acabou a requisicao") print("responseHeaders -> ") print(responseHeaders) print(responseHeaders[":status"]) print("responseBody -> ") print(responseBody) local content_length = request_handle:body():setBytes(responseBody) request_handle:headers():replace("content-length", content_length) else print("nao entrou") end end - applyTo: CLUSTER match: context: SIDECAR_OUTBOUND patch: operation: ADD value: # cluster specification name: thirdparty connect_timeout: 1.0s type: STRICT_DNS dns_lookup_family: V4_ONLY lb_policy: ROUND_ROBIN load_assignment: cluster_name: thirdparty endpoints: - lb_endpoints: - endpoint: address: socket_address: protocol: TCP address: keycloack-dev-admin.eva.bot port_value: 443The response error is:
503responseBody ->upstream connect error or disconnect/reset before headers. reset reason: connection terminationI'm using Istio v.1.11.4.