When Flex Gateway handles requests, the behavior of the x-request-id header differs depending on whether the request is internal or external:
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.
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.
005197682

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.