Closed
Description
Describe the bug
Query parameters are not rewritten correctly when a URLRewrite filter is configured.
To Reproduce
-
Create the cafe app and gateway from the cafe-example
-
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
- Tail the logs of the coffee Pod
- Send the following request
curl --resolve cafe.example.com:$GW_PORT:$GW_IP http://cafe.example.com:$GW_PORT/coffee/v1/path?TEST=v2
- 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.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
✅ Done