Skip to content

AddLinkHeadersForPreloadedAssets causes issues when there are too many files #49214

Closed
@mikethea1

Description

@mikethea1

Laravel Version

10.32.1

PHP Version

8.2.7

Database Driver & Version

AWS MySQL RDS

Description

After struggling for a while to debug a very difficult issue, I've traced it down to the AddLinkHeadersForPreloadedAssets middleware generating a header which > 8190 characters and then getting rejected by apache.

Given how difficult this is to track down (it is even dependent on your domain name so a site can work fine when hosted under one domain and then the same code fails when hosted on a longer domain) and that as I understand it this is purely an optimization, I think this middleware should be changed so that it constrains the max size of the generated header to ~8000 characters (limit could be configurable). That means fewer things get preloaded, but better than the site not working at all.

This seems to be another example of someone hitting this.

Steps To Reproduce

The link header lists all the vite preload assets; you just need to make an Inertia::render() page where the set of vite preload assets gets long enough to push this beyond what your server allows.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions