Skip to content

Body size error #5317

@llomgui

Description

@llomgui

Describe the bug
I got errors during a POST with a body size > 1mb.
It keeps returning error 500 with the following log:
2024/03/27 09:36:48 [error] 73#73: *5036785 client intended to send too large body: 1379677 bytes, client: X.X.X.X, server: example.com, request: "POST /path HTTP/1.1", subrequest: "/_jwks_uri", host: "example.com", referrer: "https://example.com/referrer"

To Reproduce
Steps to reproduce the behavior:

  1. Setup oidc policy, assign it to your virtualserver
  2. Generate calls with body size > 1mb
  3. See error

Expected behavior
No error because client-max-body-size: 128M is set in configmap and is also present in location / in VS generated file.

Your environment

  • Using Nginx Ingress v3.5.0
  • Version of Kubernetes v1.28.6
  • Kubernetes platform OKD
  • Using NGINX Plus

Cause
As you can see in the log, there is a subrequest to /_jwks_uri : https://github.com/nginxinc/kubernetes-ingress/blob/main/internal/configs/oidc/oidc.conf#L9
The solution would be to inject client_max_body_size in this location, or set client_max_body_size on the server directive instead of location. https://github.com/nginxinc/kubernetes-ingress/blob/main/internal/configs/version2/nginx-plus.virtualserver.tmpl#L79
If you wan to inject client_max_body_size on the server directive, you also need to move the struct to Server https://github.com/nginxinc/kubernetes-ingress/blob/main/internal/configs/version2/http.go#L170

Metadata

Metadata

Assignees

No one assigned

    Labels

    stalePull requests/issues with no activitywaiting for responseWaiting for author's response

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions