kit icon indicating copy to clipboard operation
kit copied to clipboard

Hooking into asset serving to avoid 404

Open andersekdahl opened this issue 4 months ago • 11 comments

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

andersekdahl avatar Oct 15 '24 20:10 andersekdahl