Loading

Flex Gateway Overwrites x-request-id Header for External Requests

Udgivelsesdato: Oct 28, 2026
Beskrivelse

When Flex Gateway handles requests, the behavior of the x-request-id header differs depending on whether the request is internal or external:

  • Internal requests: The original x-request-id value is preserved.
  • External requests: The x-request-id header is overwritten with a new value.

Example 1 – Internal Request (Header Preserved):
==> $ curl -Hx-request-id:d9173c6f-7c4a-4fd0-9527-6f8b1e95f7ff 192.168.1.6:8081/httpbin/headers

 

Logs:[flex-gateway-envoy][info] wasm log api-httpbin-p1.default.api-httpbin.default.svc main: [policy: api-httpbin-p1.default][api: api-httpbin.default.svc][req: d9173c6f-7c4a-4fd0-9527-6f8b1e95f7ff] [accessLog] {":authority":"192.168.1.6:8081",":method":"GET",":path":"/httpbin/headers",":scheme":"http","accept":"*/*","authorization":"Basic Zm9vOmJhcg==","user-agent":"curl/8.7.1","x-envoy-internal":"true","x-forwarded-for":"172.17.0.1","x-forwarded-proto":"http","x-request-id":"d9173c6f-7c4a-4fd0-9527-6f8b1e95f7ff"}

You can see the x-request-id is the same.

Example 2 – External Request (Header Overwritten):
==> curl -Hx-request-id:d9173c6f-7c4a-4fd0-9527-6f8b1e95f7ff -Hx-forwarded-for:192.1.1.1 192.168.1.6:8081/httpbin/headers

 

Logs:[flex-gateway-envoy][info] wasm log api-httpbin-p1.default.api-httpbin.default.svc main: [policy: api-httpbin-p1.default][api: api-httpbin.default.svc][req: f7ca18c1-03fe-4079-80de-702913ada93c] [accessLog] {":authority":"192.168.1.6:8081",":method":"GET",":path":"/httpbin/headers",":scheme":"http","accept":"*/*","user-agent":"curl/8.7.1","x-envoy-external-address":"172.17.0.1","x-forwarded-for":"192.1.1.1,172.17.0.1","x-forwarded-proto":"http","x-request-id":"f7ca18c1-03fe-4079-80de-702913ada93c"}

If we add some XFF headers as above, it overwrite that because the origin of the request came from the outside. The reason for this is that Flex Gateway cannot fully trust externally provided request IDs. For security and traceability, it regenerates the x-request-id when requests originate from outside the internal network.

Løsning

To resolve this issue, update your Flex Gateway to v1.11.0 then you must set the environment variable `FLEX_PRESERVE_EXTERNAL_REQUEST_ID` to `true` in order to preserve the x-request-id header.

After that, restart your flex-gateway, conduct some tests, and the problem should be resolved.

Vidensartikelnummer

005197682

 
Indlæser
Salesforce Help | Article