Protected pre-rendered routes
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 20.8k
- Forks
- 2.3k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 156
Description
Describe the problem
I have an expensive static page which also happens to be a protected route.
I would love to prerender the page, but then it is not handled by SvelteKit.
Requests for static assets — which includes pages that were already prerendered — are not handled by SvelteKit.
https://kit.svelte.dev/docs/hooks#server-hooks-handle
Describe the proposed solution
- Add another page option in
+page|layout.server.tssuch asserver: true. - Add another value for the current
prerenderoption such asprotected. - (Breaking) Convert the page
prerenderoption into an object?
type Prerender = { enabled: boolean; protected: boolean };
https://kit.svelte.dev/docs/page-options#prerender
I am sure there are other usage then protected, but it seemed the most intuitive.
Alternatives considered
No response
Importance
would make my life easier
Additional Information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the page options for +page|layout.server.ts and the prerender documentation linked in the issue, then trace how pre-rendered pages are excluded from server hooks. Define and implement a supported way for a pre-rendered protected route to retain server handling, including any option or breaking-change implications, and verify the behavior with the relevant project tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- authentication, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100