Skip to content

Protected pre-rendered routes #11700

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
hyunbinseo opened this issue Jan 22, 2024 · 1 comment
Open

Protected pre-rendered routes #11700

hyunbinseo opened this issue Jan 22, 2024 · 1 comment
Labels
feature / enhancement New feature or request

Comments

@hyunbinseo
Copy link
Contributor

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

  1. Add another page option in +page|layout.server.ts such as server: true.
  2. Add another value for the current prerender option such as protected.
  3. (Breaking) Convert the page prerender option 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

@hyunbinseo
Copy link
Contributor Author

Will be implemented in #13477

Unlike the handle hook, middleware runs on all requests, including for static assets and prerendered pages. If using server-side route resolution this means it runs prior to all navigations, no matter client- or server-side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature / enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants