router
router copied to clipboard
Unable to remove the Apollo-Expose-Query-Plan with header propagation remove regex
Describe the bug
I'm not entirely sure this is a bug however I'm not able to remove the Apollo-Expose-Query-Plan
header from propagation unless I use remove.named
.
To Reproduce Steps to reproduce the behavior:
- Setup router with header propagation with
matching
regex, propagate all request headers and then remove:
plugins:
experimental.expose_query_plan: true
headers:
all:
request:
- propagate:
matching: .*
- remove:
matching: "^x-amzn-mtls-.*"
- remove:
matching: "^Apollo-.*"
#named: Apollo-Expose-Query-Plan
- Submit request, the request should include the following headers (or similar):
Apollo-Expose-Query-Plan: true
x-amzn-mtls-clientcert-subject: CN=test,ou=web servers,o=organization,c=us
- On the subgraph server print/log the headers passed and notice that
Apollo-Expose-Query-Plan
is being propagated to the subgraphs, also notice thatx-amzn-mtls-clientcert-subject
is not being propagated correctly.
Expected behavior
I don't expect Apollo-Expose-Query-Plan
to be propagated to the subgraphs by default since it is a header that the router should consume. However using the matching expression should remove it.
Output Inspect the headers passed to the subgraph server.
Desktop (please complete the following information):
- OS: MacOS Sonoma
- Version: 14.4.1 (23E224)
Additional context I tried the following combinations:
headers:
all:
request:
- propagate:
matching: .*
- remove:
matching: "^x-amzn-mtls-.*|^Apollo-.*"
With the above the header was propagated.
headers:
all:
request:
- propagate:
matching: .*
- remove:
matching: "^(x-amzn-mtls-.*|^Apollo-.*)"
With the above the header was propagated.
headers:
all:
request:
- propagate:
matching: .*
- remove:
matching: "^x-amzn-mtls-.*"
- remove:
matching: "^Apollo-.*"
With the above the header was propagated.
headers:
all:
request:
- propagate:
matching: .*
- remove:
matching: "^x-amzn-mtls-.*"
- remove:
named: Apollo-Expose-Query-Plan
With the above the header was NOT propagated.
Given what you've written here, this should certainly be working. Have you tried any variations of casing (e.g., all lower-case), to see if that helps? I'll mark this as a bug, but your continued investigation is certainly useful. Thanks!