How to properly set site canonical URL? #77910
Unanswered
gcb
asked this question in
App Router
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When my app router application's route.ts file issue a
return NextResponse.redirect(new URL('/', req.url))
it generates a redirect header to "http://localhost:3000/"... because that's where node is serving the side.
But in any sensible deployment, you are serving from
https://example.com
and nginx, or caddy, or some other proxy is terminating the https request and proxying to localhost.What is the correct way to tell nextjs about the canonical url it must use for those headers that require full urls instead of relative?
The internet is litered with bad advice on this.
Beta Was this translation helpful? Give feedback.
All reactions