fix: add sirv middleware to serve static assets in production #2703
+19
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR fixes issue #2684, where the "Download assets" button on the /assets page returns a 404 Not Found error in the production environment.
Problem :
The custom Node.js production server (server/main.js) was configured to handle Server-Side Rendering (SSR) via h3 and the SvelteKit node adapter, but it lacked the middleware to serve static files (like assets.zip, images, etc.) that originate from the static/ directory and are copied to build/client during build.
Solution :
Test Plan
Verified the fix by running the production server locally (node server/main.js) and confirming that static files (like assets.zip) are correctly served from the build output directory (build/client/) with the correct 200 OK headers.
Related PRs and Issues
Fixes #2684
Have you read the Contributing Guidelines on issues?
Yes
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.