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

URLRewrite filter does not rewrite query parameters correctly #2862

Open
kate-osborn opened this issue Dec 4, 2024 · 1 comment · May be fixed by #2951
Open

URLRewrite filter does not rewrite query parameters correctly #2862

kate-osborn opened this issue Dec 4, 2024 · 1 comment · May be fixed by #2951
Assignees
Labels
bug Something isn't working refined Requirements are refined and the issue is ready to be implemented. size/medium Estimated to be completed within a week
Milestone

Comments

@kate-osborn
Copy link
Contributor

Describe the bug
Query parameters are not rewritten correctly when a URLRewrite filter is configured.

To Reproduce

  1. Create the cafe app and gateway from the cafe-example

  2. Create the following HTTPRoute that configures a ReplacePrefixMatch URLRewrite filter for the PathPrefix /coffee/v1:

apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: coffee
spec:
  parentRefs:
  - name: gateway
    sectionName: http
  hostnames:
  - "cafe.example.com"
  rules:
  - matches:
    - path:
        type: PathPrefix
        value: /coffee/v1
      method: GET
    filters:
      - type: URLRewrite
        urlRewrite:
          path:
            type: ReplacePrefixMatch
            replacePrefixMatch: /
    backendRefs:
    - name: coffee
      port: 80
  1. Tail the logs of the coffee Pod
  2. Send the following request curl --resolve cafe.example.com:$GW_PORT:$GW_IP http://cafe.example.com:$GW_PORT/coffee/v1/path?TEST=v2
  3. Check the access logs of the coffee Pod and you'll see that the URL was rewritten to /path%3FTEST=v2?TEST=v2

Expected behavior
The URL should be rewritten to /path?TEST=v2

Your environment

  • Version of the NGINX Gateway Fabric - v1.5
  • Version of Kubernetes - v1.31
  • Kubernetes platform (e.g. Mini-kube or GCP) - kind

Additional context
See #2858 for more details.

@mpstefan mpstefan added this to the v1.6.0 milestone Dec 4, 2024
@mpstefan mpstefan added the bug Something isn't working label Dec 4, 2024
@mpstefan mpstefan added refined Requirements are refined and the issue is ready to be implemented. size/medium Estimated to be completed within a week labels Dec 9, 2024
@salonichf5 salonichf5 moved this from 🆕 New to 🏗 In Progress in NGINX Gateway Fabric Dec 9, 2024
@salonichf5 salonichf5 moved this from 🏗 In Progress to 🆕 New in NGINX Gateway Fabric Dec 19, 2024
@salonichf5 salonichf5 removed their assignment Dec 19, 2024
@salonichf5
Copy link
Contributor

Unassigned this story from myself, since I am focusing on finishing Functional tests for upstream settings Policy. Will pick it up after finishing it!

@salonichf5 salonichf5 self-assigned this Dec 23, 2024
@salonichf5 salonichf5 moved this from 🆕 New to 🏗 In Progress in NGINX Gateway Fabric Dec 23, 2024
@salonichf5 salonichf5 moved this from 🏗 In Progress to 👀 In Review in NGINX Gateway Fabric Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working refined Requirements are refined and the issue is ready to be implemented. size/medium Estimated to be completed within a week
Projects
Status: 👀 In Review
3 participants