Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to remove the Apollo-Expose-Query-Plan with header propagation remove regex #5021

Open
machados opened this issue Apr 25, 2024 · 1 comment

Comments

@machados
Copy link

machados commented Apr 25, 2024

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:

  1. 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
  1. 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
  1. On the subgraph server print/log the headers passed and notice that Apollo-Expose-Query-Plan is being propagated to the subgraphs, also notice that x-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.

@abernix
Copy link
Member

abernix commented May 6, 2024

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants