-
Notifications
You must be signed in to change notification settings - Fork 137
Closed
Labels
bugSomething isn't workingSomething isn't workingrefinedRequirements are refined and the issue is ready to be implemented.Requirements are refined and the issue is ready to be implemented.size/largeEstimated to be completed within two weeksEstimated to be completed within two weeks
Milestone
Description
Describe the bug
If you apply a policy to a route that has http matches with a method, params, or headers defined, the policy has no affect.
To Reproduce
Steps to reproduce the behavior:
- Deploy edge (118488e) version of NGF
- Apply the files from the advanced routing example.
- Create the following policy:
apiVersion: gateway.nginx.org/v1alpha1
kind: ClientSettingsPolicy
metadata:
name: tea
namespace: default
spec:
targetRef:
group: gateway.networking.k8s.io
kind: HTTPRoute
name: tea
body:
maxSize: "50"
- Send the following request to the tea application:
curl --resolve cafe.example.com:$GW_PORT:$GW_IP http://cafe.example.com:$GW_PORT/tea -X POST --data "this payload is greater than fifty bytes but less than seventy five"
Expected behavior
You should receive a 413 entity too large since the request body exceeds the limit
Your environment
- Version of the NGINX Gateway Fabric - edge 118488e
Additional context
The policy is correctly included in the named location block for the tea routes, but the directives are ignored by nginx. This seems to be a limitation of named locations in nginx.
For example, this config with named locations does not enforce the client max body size:
server {
listen 80;
location / {
try_files /dev/null @named;
}
location @named {
client_max_body_size 50;
return 200 "ok two";
}
}
however, if you change the named location to an internal location:
server {
listen 80;
location / {
try_files /dev/null /not-named;
}
location /not-named {
internal;
client_max_body_size 50;
return 200 "ok two";
}
}
it does work.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingrefinedRequirements are refined and the issue is ready to be implemented.Requirements are refined and the issue is ready to be implemented.size/largeEstimated to be completed within two weeksEstimated to be completed within two weeks