Troubleshooting Center
Menu
← All guides

Machine translation · Korean original

Fix HTTP 411 Length Required by checking the request headers and calculating the body length in bytes

A sign displaying 411 and Content-Length information after a translation request
Translation request screen example

After sending a file or form HTTP 411 Length Required If it appears, keep the original tab and look for the name ‘Content-Length’ in the error body. 411 means the server rejected a request with an undefined body length. If you are a website user, please check your submission history before resubmitting immediately. If you're managing an API, look at the request headers actually sent by the client, not the response headers.

Check error messages and failed operations

On your computer or phone, check which action is followed by 411. For example, if you enter a translated sentence and press send, distinguish between the original text and the error description shown on the screen. This doesn't mean you fail because your sentences are too short or too long. What the server requests is information that tells it the size of the body to be delivered. Read the actual numbers before you recklessly shorten your input sentences.

Screen showing translation request rejected with 411 and explanation that length of request body is required
Error screen example · Check the header name required for the request.

In the MDN example, when we send the body part to the translation API, the server responds that “a content-length header is required in the request.” If the response body is JSON, there may be a description to the same effect in the message item. In cases where the site only shows a number, ‘411 is displayed after pressing send’ is something I personally observed. Check how the client sent it when you can see the relevant records.

Web form users should first check whether the entered information remains. For tasks that would be difficult to duplicate, such as application or payment, check if there is a receipt number, order details, or completion notification in a separate window. If file upload and final submission are separate services, the previous step may have already been completed. Don't judge your entire application as a failure from the start just because of one 411 on the screen.

Distinguishing Content-Length of request and response

Developers or service personnel can select failed requests from client logs or existing network records. If you use your PC browser's developer tools, open the item with status 411 in Network and check the action path and method. Image views and form submissions can be recorded together on the same screen, so make sure you're not looking at the size of the image that came out OK instead of the form that failed.

A screen that separately displays the chunked request and the Content-Length of the response in a network tool.
Header screen example · The length of the response, 110, is not the length of the original request body.

In Headers Request Headers and Response Headers Distinguish. The former is information sent by the client, and the latter is information returned by the server. The 411 response in the MDN example also has Content-Length. This is the length of the response body containing the explanatory message. Just because you see this number, you should not assume that the original request included the length and should not copy that value into your request.

Marks seen in records What the sign describes Next check
Content-Length of the request Number of bytes of body to send Does it match the actual transmission body?
Content-Length of the response Number of bytes in message returned Open request headers separately
Chunked of requests Fragment-based transfer in HTTP/1.1 Check if server requires full length

Check the number of bytes in the final body instead of the number of characters

The unit of Content-Length is bytes, not characters. ‘Hangul’ is two characters on the screen, but when encoded in UTF-8, it is six bytes. If you enter these words as a JSON value, field names and phrases such as quotes and braces are also included in the body. If you count the number of characters visible in the input window or the length of the original file name as the header value, it does not match the actual transmission amount.

The same applies to sending files in a form. If the transmission body contains field names and delimiter information in addition to the file, the capacity of the file properties window will differ from the total request length. So don't just guess the size or copy the numbers you used in past requests. It is correct to let your HTTP client construct the final body and then calculate its length.

Browser form users do not need to find a box to directly enter header values. Setting headers is the responsibility of the web app and browser. Even if the site has separate file size limits, 411 is a different response than 413. 413 means that the text is too large, so it may be correct to advise to reduce the file, but in 411, even if the size is reduced, the transmission method with an undefined length may remain.

Choose a transmission method whose length is known

In HTTP/1.1, the chunked method of dividing the body into pieces and sending the size for each piece does not send the entire Content-Length. This is useful for reading data into a stream and sending it straight away, but some servers respond with a 411 to this method because they need to know the total length before receiving the request. The length of a single fragment or the number of fragments should not be interpreted as the length of the entire text.

If you're an API owner, read the integration documentation to see what transport method your operation requires. When sending a short JSON, prepare the completed text as a byte string and then use an input format that allows the library to know the size and transmit it. Avoid leaving streams whose length is unknown and adding a separately guessed Content-Length to them. Specifying headers for both transport methods simultaneously is not a workaround.

If it is a large file, before uploading the entire file to memory, check whether the client you are using supports file bodies of known length and whether there is an upload path officially provided by the service. Comparing the pre- and post-modification records to see if the failed operation is the same and if the length of the final request was determined by the client can reveal whether the transfer conditions actually changed.

Send it again and check the results

General users should only try again using the method provided on the official screen, and for applications that you are not sure whether they will be processed or not, seek guidance from customer support first. In API integration, the transmission conditions are modified and the data is checked to ensure there is no risk of duplicate processing. Even if 411 disappears in the new response, the next input validation may fail, so read the status number and result body together.

Final confirmation serves its original purpose. If you are searching for a translation, check whether the results are in the requested language, and if you are uploading a file, check whether the data with the expected name and size is saved in the folder. If it continues to fail, leave a comment indicating the time and time zone, action path, method, 411 phrase, and request length. There is no need to pass authentication information or the entire original text of the file to help the person in charge check which section is missing length information.

official data · MDN · 411 Length Required

official help

Check official documentation ·

Inspection information

public status
public
Document inspection date
Scheduled for next review
direct reproduction
no record

This article was written based on official documents. We don't represent things as if we experienced them unless we reproduced them ourselves.