413 unity network_error ai_generated partial

UnityWebRequest: HTTP/1.1 413 Request Entity Too Large

ID: unity/unitywebrequest-error-http-413

Also available as: JSON · Markdown · 中文
90%Fix Rate
87%Confidence
1Evidence
2024-01-20First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
Unity 2022.3.25f1 active
Unity 2023.3.0b3 active
Unity 2021.3.40f1 active

Root Cause

The server rejected the upload or download because the payload exceeds the maximum allowed size configured on the server, often due to large asset bundles or JSON data.

generic

中文

服务器拒绝了上传或下载,因为负载超过了服务器配置的最大允许大小,通常是由于过大的资源包或 JSON 数据。

Official Documentation

https://docs.unity3d.com/ScriptReference/Networking.UnityWebRequest.html

Workarounds

  1. 90% success Split the upload into multiple smaller chunks using a custom chunked upload implementation, or increase the server's max request size (e.g., in ASP.NET set maxRequestBodySize in web.config).
    Split the upload into multiple smaller chunks using a custom chunked upload implementation, or increase the server's max request size (e.g., in ASP.NET set maxRequestBodySize in web.config).
  2. 85% success Compress the payload before sending using GZip/Deflate and set Content-Encoding header. Ensure server supports decompression.
    Compress the payload before sending using GZip/Deflate and set Content-Encoding header. Ensure server supports decompression.

中文步骤

  1. Split the upload into multiple smaller chunks using a custom chunked upload implementation, or increase the server's max request size (e.g., in ASP.NET set maxRequestBodySize in web.config).
  2. Compress the payload before sending using GZip/Deflate and set Content-Encoding header. Ensure server supports decompression.

Dead Ends

Common approaches that don't work:

  1. 95% fail

    Timeout controls how long to wait for a response, not the payload size limit.

  2. 90% fail

    The 413 error is about request body size, not the HTTP method.

  3. 85% fail

    Compression affects transfer encoding, not the entity size limit.