-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
Link with absolute url throws errors #8555
Comments
I feel something isn't right about this issue.
Isn't the next app itself should be served from same server? I primary use to route between next's pages internally, not for fetching external resources. The other content you mentioned, is it image, video, or data api? If so, I see no reason to use to route the page into those resources. |
We host and share content ( think youtube, where the video container itself is an iframe that people can embed, and the rest of the page are related videos, social features etc ). The video container would be on In general we prefer to be on https, and so we have For this issue specific: when you do And in general: the We can create our own |
It would load You can write a wrapper for Eventually |
# Issue - <Link> tells next router to get the content from static server - For external url, this is inappropriate. @see vercel/next.js#8555 (comment) # Solution - Use <a> tag without <Link>
I also had the same issue when pass absolute url to Link. |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
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 seeRouter.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
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 thehref
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.The text was updated successfully, but these errors were encountered: