Skip to content

Hooking into asset serving to avoid 404 #12815

@andersekdahl

Description

@andersekdahl

Describe the problem

From what I know it's not possible to hook into the serving of build artifacts in the _app folder. The biggest use case I have for it is to be able to hook into it to prevent 404s on assets that no longer exists which is an issue during deployment where clients are still on the "old" version in their browser.

Another use case is being able to have middlewares for the build artifact files to set custom headers, but that's a lot less important.

Describe the proposed solution

Some way of registering a 404 handler for the _app folder or some sort of middleware where I would be able to detect a 404 and prevent it from really becoming a 404.

Alternatives considered

I'm not aware of a way to solve this except perhaps building my own Sveltekit adapter which feels overkill for this.

Importance

would make my life easier

Additional Information

No response

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