Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POST requests with large bodies fail on subrequest to /_jwks_uri #100

Open
alanwilkie-finocomp opened this issue Aug 22, 2024 · 0 comments

Comments

@alanwilkie-finocomp
Copy link
Contributor

When a POST request with a large body is sent to an endpoint that has client_max_body_size set appropriately at the "location" level, the request returns 500. Normally, a request that fails the client_max_body_size check returns a 413 error, so the 500 error implies that a check is failing after the initial request. The nginx log shows messages like:
2024/08/22 02:18:47 [error] 6252#6252: *704866 client intended to send too large body: 1143545 bytes, client: 192.168.46.29, server: devcluster.finocomp.local, request: "POST /upload HTTP/1.1", subrequest: "/_jwks_uri", host: "devcluster.finocomp.local", referrer: "http://devcluster.finocomp.local/upload"

The mention of subrequest: "/_jwks_uri" led me to look at its configuration in openid_connect.server_conf. My suspicion is that the body size is being checked before the subrequest is performed, even though proxy_method GET and proxy_set_header Content-Length "" are being applied.

I modified the configuration to add a client_max_body_size directive:

    location = /_jwks_uri {
        internal;
        client_max_body_size 0;
        # ... etc ...

Large file uploads now work as expected.

I think it should be safe to disable the client_max_body_size check here because the subrequest is proxied as a GET regardless of the original request type and should never have a body.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant