Describe the bug
BackendGroups with namespace starts with digit doesn't proxy_passed to split_clients correctly.
For example, we have a namespace named 9c-network and one of its routes has multiple backends.
So ngf creates a split_clients named $9c_network__some_route_name_rule0 and generates a line proxy_pass http://$9c_network__some_route_name_rule0$request_uri;
However, it seems nginx processes the proxy_pass parameter as $9, c_network__..., not $9c_network__....
nginx responds with 502 Bad Gateway and I found a log that says no resolver defined to resolve c_network__some_route_name_rule0.
I suspect nginx think it's regex capture group if a split_clients starts with number.
To Reproduce
Steps to reproduce the behavior:
create a namespace which its name starts with a digit
create a random HTTPRoute in the namespace with parentRef pointing nginx-gateway-fabric
http request to the route and see if it works
Expected behavior
responds with 2xx~4xx, not 502 Bad Gateway
Your environment
Version of the NGINX Gateway Fabric - release version or a specific commit. The first line of the nginx-gateway container logs includes the commit info.: "version":"1.4.0","commit":"8e653d6dfc671ca8f8d51f3eed29c25462f96e41"
Version of Kubernetes: 1.28
Kubernetes platform (e.g. Mini-kube or GCP): AWS EKS
Details on how you expose the NGINX Gateway Fabric Pod (e.g. Service of type LoadBalancer or port-forward): LoadBalancer with AWS NLB
Thanks for opening this issue!
Be sure to check out our Contributing Guidelines and the Issue Lifecycle while you wait for someone on the team to take a look at this.
Describe the bug BackendGroups with namespace starts with digit doesn't proxy_passed to split_clients correctly. For example, we have a namespace named
9c-network
and one of its routes has multiple backends. So ngf creates a split_clients named$9c_network__some_route_name_rule0
and generates a lineproxy_pass http://$9c_network__some_route_name_rule0$request_uri;
However, it seems nginx processes the proxy_pass parameter as$9
,c_network__...
, not$9c_network__...
. nginx responds with502 Bad Gateway
and I found a log that saysno resolver defined to resolve c_network__some_route_name_rule0
. I suspect nginx think it's regex capture group if a split_clients starts with number.To Reproduce Steps to reproduce the behavior:
Expected behavior responds with 2xx~4xx, not 502 Bad Gateway
Your environment
"version":"1.4.0","commit":"8e653d6dfc671ca8f8d51f3eed29c25462f96e41"
Logs of NGINX container:
kubectl -n nginx-gateway logs -l app=nginx-gateway -c nginx
Details
NGINX Configuration:
kubectl -n nginx-gateway exec <gateway-pod> -c nginx -- nginx -T
Details
Additional context I think it can be resolved by simply adding something before first %s https://github.com/nginxinc/nginx-gateway-fabric/blob/88269accb505d58567fde59dec3830cf963dc968/internal/mode/static/state/dataplane/types.go#L258 https://github.com/nginx/nginx/blob/51857ce40400b48bc8900b9e3930cf7474fa0c41/src/http/ngx_http_script.c#L474-L480