在应用程序的响应中,我们看到双倍的传输编码标头。
假设因为我们在 UI 中得到 503,但同时应用程序在 pod 的日志中返回 201。
除了日志http code: 201
中有transfer-encoding=chunked
和Transfer-Encoding=chunked
标头,这可能是 503 的原因。
我们尝试transfer-encoding
通过 Istio 虚拟服务或特使过滤器删除,但没有运气..
以下是我们尝试过的示例:
VS定义:
kind: VirtualService
apiVersion: networking.istio.io/v1alpha3
metadata:
name: test
namespace: my-ns
spec:
hosts:
- my-service
http:
- route:
- destination:
host: my-service
headers:
response:
remove:
- transfer-encoding
---
kind: VirtualService
apiVersion: networking.istio.io/v1alpha3
metadata:
name: test
namespace: istio-system
spec:
gateways:
- wildcard-api-gateway
hosts:
- my-ns_domain
http:
- match:
- uri:
prefix: /operator/api/my-service
rewrite:
uri: /my-service
route:
- destination:
host: >-
my-service.my-ns.svc.cluster.local
port:
number: 8080
headers:
response:
remove:
- transfer-encoding
EnvoyFilter 定义:
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: test
namespace: istio-system
spec:
configPatches:
- applyTo: HTTP_FILTER
match:
context: SIDECAR_OUTBOUND
patch:
operation: ADD
value:
name: envoy.filters.http.lua
typed_config:
"@type": "type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua"
inlineCode: |
function envoy_on_response(response_handle)
response_handle:headers():remove("transfer-encoding")
end
在较旧的特使版本中,我看到envoy.reloadable_features.reject_unsupported_transfer_encodings=false
是一种解决方法。不幸的是,它已被弃用。
请告知 VS/filter 有什么问题,或者是否有任何替代reject_unsupported_transfer_encodings
选项?
Istio v1.8.2
特使 v1.16.1