The transform/wikitext/to/mobile-html/ endpoint (which we use for previewing edits) returns HTTP 413 (Content Too Large) if a large-enough amount of text is given to it. Let's document the exact size that the endpoint deems "too large" and decide what our behavior should be in that case, or whether to potentially expand the maximum size at the endpoint level.
Description
Details
| Subject | Author | Repo | Branch | Lines +/- | |
|---|---|---|---|---|---|
| mobileapps: Change max_body_size to 2mb from the 100kb default | Arlolra | operations/deployment-charts | master | +4 -1 |
Related Objects
- Mentioned Here
- P80977 (An Untitled Masterwork)
Event Timeline
It seems that the 413 comes from MW when mobileapps converts wikitext to html, possibly Parsoid.
We don't have client-side metrics for this, unfortunately, but it can be reproduced easily by editing a sufficiently large article and attempting to "preview" it. (The app will allow the edit to proceed; it's just the preview becomes broken with this error.)
It would just be useful to know the actual maximum content size that the wikitext/to/mobile-html/ endpoint supports, and whether it could possibly be increased to match the maximum wikitext size in mediawiki.
I tried a few requests and i managed to get a 413 Payload too large by sending a request like:
POST https://en.wikipedia.org/api/rest_v1/transform/wikitext/to/mobile-html/Earth
Body
{
wikitext: "
'{102871 bytes of chars}'
"
}More specifically here is a very verbose curl command:
https://phabricator.wikimedia.org/P80977
This error present in other wikis too (hi,mr,te) if you try to edit full page via app.
This error present in other wikis too (hi,mr,te) if you try to edit full page via app.
I don't believe it's critical, since it doesn't really "block" our workflow of editing articles; it just prevents a preview from being shown.
It would be useful to know what is the actual maximum length that this API currently supports. This way, we can at least have the option of working around the issue by explicitly truncating the wikitext that we submit for previewing.
Change #1179235 had a related patch set uploaded (by Arlolra; author: Arlolra):
[operations/deployment-charts@master] mobileapps: Change max_body_size to 2mb from the 100kb default
Looks like this needs setting,
app.use(bodyParser.json({ limit: app.conf.max_body_size || '100kb' }));
https://github.com/wikimedia/mediawiki-services-mobileapps/blob/master/app.js#L167
Change #1179235 merged by jenkins-bot:
[operations/deployment-charts@master] mobileapps: Change max_body_size to 2mb from the 100kb default
Post-deploy, this no longer returns a 413
In T398838#11094762, the max_body_size was changed from 100kb to 2mb
It's been a month, and the solution hasn't been rolled out to alpha builds yet. For non-coder editors, the preview is an essential feature. Therefore, I am changing the status to "in progress" because it hasn't been resolved on the client side yet.
Can you give a specific example? (And could you provide the version of the app you're using?)
Sorry for the oversight. I reset the app data for the alpha version, and it’s working now. The screenshot I shared was of the F-Droid version r/2.7.50543-r-2025-07-31, which still has the issue. I used the article on Tamannaah Bhatia for editing.
Sounds good - closing; And note that r/2.7.50543-r-2025-07-31 is a bit outdated -- not sure why F-Droid hasn't synced to our latest version yet.
