-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
bugAn issue reporting a potential bugAn issue reporting a potential bug
Milestone
Description
Describe the bug
When creating a VirtualServer with a route that contains a match condition and a rewritePath, it seems to create wrong rewrite rules. On the proxy destination i can observere request parameters duplicated.
To Reproduce
- Create the following VirtualServer
apiVersion: k8s.nginx.org/v1
kind: VirtualServer
metadata:
name: myvserver
spec:
host: myvserver.example.org
server-snippets: |
rewrite_log on;
upstreams:
- name: app
service: myservice
port: 8666
routes:
- path: /
action:
pass: app
- path: /demo
matches:
- conditions:
- cookie: user
value: john
action:
proxy:
upstream: app
rewritePath: /user/john
action:
proxy:
upstream: app
rewritePath: /
- Do a curl request to the created vhost. It doesn't matter it if the conditions is matched or not.
$ curl http://myvserver.example.org/demo?hello=world
...
- Observe in the access log of app that the request is proxied in an unexpected way
10.142.184.178 - - [21/Sep/2021:16:21:49 +0000] "GET /%3Fhello=world?hello=world HTTP/1.1" 404 153 "-" "curl/7.64.1"
The location block in the generated config seems to be like this:
...
location /internal_location_matches_0_default {
set $service "myservice";
internal;
set $default_connection_header close;
rewrite ^ $request_uri;
rewrite "^/demo(.*)$" "/$1" break;
...
Expected behavior
The requests are proxied to the destination as /?hello=world.
Your environment
- 1.12.1 (installed via nginx-ingress-0.0.0-edge helm chart)
- 1.20.7
- Azure Kubernetes (AKS)
- Nginx + NginxPlus (on eval license)
Additional context
Without the matches: block the request is correctly passed to the upstream.
Aha! Link: https://nginx.aha.io/features/IC-280
Metadata
Metadata
Assignees
Labels
bugAn issue reporting a potential bugAn issue reporting a potential bug