-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
+layout.server.ts is inconsistant host #10586
Comments
If you need to control the origin used in prerendered pages, use If you need this to be dynamic for different on a given route, you can't use prerendering for that route and need to disabled it - https://kit.svelte.dev/docs/page-options#prerender |
@Conduitry hey, thanks for closing so fast but this doesn't seem like expected behavior. It should be consistent, if I visit a url it should show what that url is instead of hiding it and warping the result. I spent a few debugging for something that feels like a core platform issue. For example To be honest I'm not too happy that SvelteKit is doing funky stuff like this; makes me want to leave the platform. Also the link you provided https://kit.svelte.dev/docs/configuration#prerender; I don't see how this addresses this funky annoying issue that emulates a bug? I don't see anything in "prerender" that relates... |
@Conduitry for example, all these values for root say "http://sveltekit-prerender/" which is completely incorrect, they do not reflect real host values. This issue should be reopened.. When visiting 'mydomain.com'
When visiting 'mydomain.com/some-url'
|
@Conduitry and based of the link you sent, which by the way is almost useless. It doesn't explain anything or how to fix this. This is a bug; how can a server dynamically load a url? What use is this too me?... |
@Conduitry also why does this 'request' work for other urls except root, that makes no sense? Since they are SSR, seems like a core platform bug The browser already sends the url with the request in the headers, so this doesn't make any sense, SSR should be able to see the url on all routes (which it does except root) |
Are you prerendering your root route? Because if yes, then there's no way how SvelteKit can magically know where you're deplying to, and you need to use said prerendering setting. If no, please provide a reproduction. |
@dummdidumm yes I'm per-rendering all roots. I've noticed that |
Please provide a reproduction in the form of a repository of Stackblitz link then. Also I don't know what you mean by "all roots", "/" is the only root of an app. |
@dummdidumm if you create a base project and use +layout.server.ts with +layout.page.ts you can see the bug. on "/" it's not called. On other roots it is. With hooks it doesn't show the correct url. For other SSR routes it does. I can create a whole project for you if yo want? |
Yes, please share a full repository or Stackblitz link. I think we're talking past each other and having a full code example where you say what you expect to work that doesn't it's easier |
@dummdidumm btw it seems to only bug when hosted (built and deployed) using the node-adaptor Make a fresh project
then add +layout.server.ts
|
@dummdidumm this only fires for anything that isn't root. |
Again, please provide a reproduction linking to a Stackblitz or Github project. These scattered infos and manual steps that gloss over details are all prone to misunderstanding. |
@dummdidumm Sure, here is a project that emulates the broken functionality, you will need to look at server logs to validate it, not sure how to do that on StackBlitz, I'm hosting with K8. The root doesn't fire, but loading from another url does. Also, in server hooks the url is incorrect, showing 'http://sveltekit-prerender/' but this is not the case in other roots (loaded from scratch).. https://github.com/ollyde/example-sveltekit-root-page-load-broken |
Describe the bug
Reproduction
Above
Logs
System Info
System: OS: macOS 13.4.1 CPU: (8) arm64 Apple M1 Pro Memory: 89.66 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 20.3.1 - /opt/homebrew/bin/node npm: 9.6.7 - /opt/homebrew/bin/npm pnpm: 8.6.12 - ~/Library/pnpm/pnpm Browsers: Chrome: 116.0.5845.96 Safari: 16.5.1
Severity
blocking all usage of SvelteKit
Additional Information
No response
The text was updated successfully, but these errors were encountered: