-
Notifications
You must be signed in to change notification settings - Fork 30.2k
Description
Bug report
The <Link> component no longer works with absolute urls, even when these urls don't navigate to a different domain.
Describe the bug
While updating NextJS from 9.0.1 to 9.0.5 I noticed that the Router complains when href contains a protocol ( from an absolute url ), even when this url does not navigate away from the SPA.
To Reproduce
Create a <Link href="http://localhost:3000/a" /> and see Router.prefetch. This is the PR that introduced the behavior ( #8231 0.
https://github.com/ReinoutStevens/nextjs-link-absolute-url
Expected behavior
Absolute urls that do not leave the application should work. Ideally, <Link> supports href's going to external domains as well ( see additional context ).
System information
- Version of Next.js: [e.g. 9.0.5, latest]
Additional context
Apparently <Link> should not be used to link to external domains, even though this was supported. Is there a motivation for this, as we have content that can only be served over http, and other content that is served over https. We cannot know this beforehand, and it would be nice if we can just consistently use <Link> throughout the app, where a link to an external site would just place the href on the <a> element. Could I also get a clarification on NextJS stand on this behavior, and whether we should build our own Link component that supports this behavior.