Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

X-Debug-Exception header too long causes web server returning 5xx instead of proper error page #48391

Copy link
Copy link
Closed
@paxal

Description

@paxal
Issue body actions

Symfony version(s) affected

=5.1

Description

5.1 introduced the X-Debug-Exception header when in debug mode.
Because this header is not truncated and because web servers don't allow infinite header size (single-header / all headers limitations), the web server might return a native 5xx error page instead of proper symfony error page.

See #36003 (comment) first issue report (this is the initial PR, not an issue)

How to reproduce

Just throw a big exception, with debug mode enabled :

throw new \Exception(str_repeat('0', 32000));

In my case, it's a DB query with some JOIN and a lot of fields that fail for instance when a migration has not been executed yet.

Possible Solution

Truncate the header, for instance to 2kB to have some space left for other headers, because a web server might have a limitation for the size of all the headers, and not only per-header-line size limit.

Additional Context

Typical nginx log (502) :

upstream sent too big header while reading response header from upstream

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.