The large attachment upload is blocked at 413, why is it not understandable in the browser?

📅 2026-10-11 👁️ 15

When uploading a large attachment, it is blocked by the gateway and returns 413. The reason it is not understandable in the browser is that this restriction has already taken effect before the request enters the application: The layer that acts as the reverse proxy reads the size in the request header to decide whether to allow or not. The program has no chance to take over this request, so it cannot return a unified error message format within the site. What users often see is a blank page or a prompt without context, rather than 'which file is over the limit'.

Which part does the upper limit control?

It manages the volume of the entire request body, not the size of a single file. When attachments, fields, and tokens are included in the form at the same time, these contents are merged for calculation, so it is often the case that other fields exceed the volume and cause the blockage.

The default value given by the reverse proxy layer is not high, the corresponding directive of nginx is set to one megabyte by default, and can be overridden at three levels: the whole site, a single site, and a single position. That is to say, the upload entrance and interface entrance in the same site can have different upper limits, and it is more stable to configure separately according to the entrance than to increase the whole site.

Why the error cannot be read in the browser

An exceeded limit response is directly given by the proxy layer, usually without the station's page template and not going through the front-end error handling branch. The front-end script waits for a structured return, but receives a minimal response instead, resulting in a stuck progress bar, missing prompts, or continuously displaying uploading.

To make it readable, it needs to be coordinated at two places: first, the front-end needs to do local volume verification before submission, blocking excessive requests before initiating the request; second, the application layer outside the proxy layer also needs to have its own limit, the relationship between the two levels of limits is that 'the application layer is not higher than the proxy layer', otherwise excessive requests will first enter the program and then be rejected by internal rules, and the error message will finally have an in-site format.

How to check the three types of upload entries within the site

Entry Common volume Where to configure the limit Verification method
Background attachment upload Single image and document The proxy layer is opened separately according to the upload path Try once with a real file close to the limit
Batch import Zip file and table Release the entire proxy layer, control the program side by item count Run one ZIP and one Excel file separately
Upload attachments through the interface File content encoded in base64 Check both the program and the proxy Pay attention to the volume increase caused by encoding

The batch import within the site supports compressed packages and spreadsheet formats. Such requests are large in volume and time-consuming, and it is common to encounter the situation where the page can be uploaded but the interface cannot when only one limit is adjusted. Moreover, when uploading attachments through the interface, the file content is placed in the request body in base64 encoding format, which itself causes volume expansion, and it is easy to underestimate the limit when estimated based on the original file size.

There is also an easy-to-miss place during deployment.

The program listens to port 8001 by default, which is usually forwarded by a reverse proxy. When deploying, make sure that the forwarding section of the proxy is also subject to the same upper limit constraint: when there are multiple proxy layers, each layer must be opened up, and only changing the outermost layer will cause the network environment to change from good to bad. Similarly, timeout and volume are two types of parameters, adjusting only the volume and not the timeout will still cause large attachments to break off during transmission.

Common questions

Is it okay to change only one upper limit?No, proxy layer, application layer, and front-end verification are three places, and only releasing one will move the error to a worse-to-read position.

Why is it still failing after changing it?First, check if it is a timeout issue and not a volume issue; then see if the request has gone through multiple proxies; finally, verify if the interface and page are using the same configuration.

Should the upload limit for images and attachments be the same?It is more reasonable to separate them, with the upper limit for regular images low, and the upper limit for attachments and import packages high, covering them by path is safer than the entire site.

What should be paid attention to when uploading encoded content?The request body after encoding is larger than the original file, leave some margin when estimating, and distinguish in the log between 'blocked by proxy' and 'rejected by the program'.

Related articles

What codes should be returned for deleted articles and hidden columns, and what consequences will there be if they are all compressed into 404?

When deleting content or hiding columns, if the status code is unified to 404, the still existing paths will be read as expired. This article gives the landing points for the four types of semantics: delete, hide, reject, and exception, and explains how the recycling station, draft, and pending publication status within the site correspond to the front-end return, and attaches a list of standards for reference

2026-10-11

How will the front-end sorting and push be chaotic when the scheduled publication time zone difference is taken into account

Schedule publishing so that content transitions from pending to official at the specified time. Time zone differences can cause the overall launch time to shift, which may affect the sorting of content by release time on the front end and the timing of link promotions. First, clarify the visibility scope of the three states: pending, official, and recycling bin. Then, unify the time zone standards and verify the release time together during backup and recovery.

2026-10-11

Why are all the client addresses logged in the log all proxy addresses when a proxy is hung in front of the website?

After the reverse proxy, only the proxy address remains in the log because the connection indeed comes from the proxy. The real source needs to be obtained from the forwarding header, but this header can be forged, and only the section appended by the trusted proxy should be believed when retrieving the value. This article explains the alignment of the order, trust boundaries, and the three steps on the deployment side.

2026-10-11

How to match the program port and gateway port when running the website building program in the container

Containerized deployment of website programs requires three layers of ports: program listening, container mapping, and gateway outward. This article takes the default listening port as an example to explain the corresponding relationship of the three layers, typical performance when the mapping is written incorrectly, and the request headers that need to be supplemented for reverse proxy and the items that need to be checked after deployment.

2026-10-11

Content security policy reports first and does not block, deciding to really block after seeing what happens

Content Security Policy runs in only-report mode first, used to collect violation records without blocking execution, which is a gray-scale method before going live with intercept rules. There are two ways to write the report target, new browsers will ignore the old address, and both should be written during the compatibility period. This article explains what types of information to look at during the gray period, when to cut off the intercept, and how to avoid a blank screen when changing the template.

2026-10-11

Add integrity verification to external scripts, why do you still need to explicitly write cross-domain attributes in the tag?

When adding integrity check to external scripts, the cross-domain attribute must be explicitly written in the tag, because resources with integrity check must go through cross-domain requests, otherwise the browser will not consider the check result as available. The check value consists of an algorithm prefix plus an encoded hash, and multiple summary alternatives can be provided at the same time. This article explains where the check occurs, the format and alternatives, as well as how to batch verify reference points after template changes.

2026-10-11

How many addresses can a single sitemap file hold, and how should it be split if it exceeds the limit?

The single sitemap file has two concurrent limits: the number of addresses should not exceed 50,000, the uncompressed volume should not exceed 50MB, and any that reach the top must be split into multiple fragment files, and then a index file is used to list the fragments one by one. This article explains how to calculate the limit according to the original protocol, how to name the fragment directory stably, the division of labor between the index file and the sub-maps, as well as the pseudo-static rules and configuration to check when the background automatically generates the sitemap, to avoid bypassing the limit by trimming the number of addresses in an erroneous manner.

2026-10-12

How to fill in the last modified time in the sitemap so that it is easy to be accepted.

The last modified time in the sitemap should be filled in according to the actual change: the protocol requires the use of W3C Datetime format, which can only be written as a date; changefreq and priority are defined as hints rather than instructions, and full-site refresh will only make the crawler treat this field as noise. This article explains the protocol meaning of this field, the four common ways it is filled incorrectly, how to obtain the real change time from the content status, and the time scope to be noted when配合 with timed publishing.

2026-10-12