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

Introduce a configurable limit to HTTP API request body size #9708

Merged
merged 3 commits into from
Oct 17, 2023

Conversation

michaelklishin
Copy link
Member

@michaelklishin michaelklishin commented Oct 16, 2023

The default is 10 MiB, enough to import a definition file with 100K queues over the HTTP API, or publish a message over the HTTP API (something that is highly discouraged) close to 10 MiB in size.

Note that rabbitmqctl import_definitions and boot time node-local definition import are not affected, only the HTTP API is.

To override the limit (if you are really sure you need to do this):

# In rabbitmq.conf, this bumps the limit to 20 MiB
management.http.max_body_size = 20000000

The default is 20 MiB, which is enough to upload
a definition file with 200K queues, a few virtual host
and a few users. In other words, it should accomodate
a lot of environments.
per discussion with the team.

It should be enough to accomodate a definition file with about
100K queues.
to take the newly introduced 10 MiB default body size limit
into account.
@michaelklishin michaelklishin merged commit 6009a49 into main Oct 17, 2023
16 checks passed
@michaelklishin michaelklishin deleted the mk-limit-max-http-api-payload-size branch October 17, 2023 01:49
michaelklishin added a commit that referenced this pull request Oct 17, 2023
Introduce a configurable limit to HTTP API request body size (backport #9708)
michaelklishin added a commit that referenced this pull request Oct 17, 2023
Introduce a configurable limit to HTTP API request body size (backport #9708) (backport #9709)
@qlong1505
Copy link

Hi @michaelklishin
At file deps/rabbitmq_management/src/rabbit_mgmt_util.erl, line 693

case bit_size(Acc) > BodySizeLimit of

If I set in rabbitmq.conf file as management.http.max_body_size = 20000000, does it means that the maximum body size is only set at about 20Mbit base on the logic above? From the beginning I assume it is MiB but I always received

{
    "error": "bad_request",
    "reason": "Exceeded HTTP request body size limit"
}

when trying to push a msg size 15MB via http API. If I change the ``management.http.max_body_size = 160000000` then I receive

{"routed":true}

@michaelklishin
Copy link
Member Author

@qlong1505 the value is in bytes, as the name suggests. The computed body size is also in bytes.

The limit is meant to help you establish a guard rail, not allow for super fine grained control down to the byte.

Please use GitHub Discussions for questions. And consumer publishing using a regular messaging client and not the HTTP API, in particular for large messages.

@rabbitmq rabbitmq locked and limited conversation to collaborators Nov 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants