Skip to content

🐛 [Bug]: better error handling for file exceeding body size limit #3803

@Abhinavbhar

Description

@Abhinavbhar

Bug Description

Limit for the fiber body is 4mb.
When a client send a file bigger than 4mb fiber returns a completely unrelated cors error.
This leads to confusion and wasting of developer time till developer lands on a page that explains this.

How to Reproduce

Steps to reproduce the behavior:

  1. setup a basic fiber server and make a handler to receive multipart form
  2. from browser send a file bigger than 4mb
  3. this will give cors error completely unrelated anything that is actually happening

Expected Behavior

a error that clearly says that the request exceeds the allowed size limit and not a cors error.

Fiber Version

v2.52.9

Code Snippet (optional)

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:8080/largefile. (Reason: CORS request did not succeed). Status code: (null).

//error got
which is completely unrelated and could not find any documentation about this error potentially being a size limit error.

Checklist:

  • I agree to follow Fiber's Code of Conduct.
  • I have checked for existing issues that describe my problem prior to opening this one.
  • I understand that improperly formatted bug reports may be closed without explanation.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions