If you are deploying to Vercel for production and you have set up a custom domain, you can access the same page from the following three URLs.
1. https://[vercelProjectName]-[vercelUserName].vercel.app
2. https://[vercelProjectName]-[deployId]-[vercelUserName].vercel.app
3. https://[myDomain].com
Furthermore, all of them exist independently, without being redirected to a custom domain.
However, it seems that URLs in 1. are not registered with search engines, so you can leave them alone.
Are Vercel Preview Deployments indexed by search engines? – Vercel Docs
Still, the URLs for 2. and 3. are duplicated.
Is there any way to redirect the user to URL 3. when accessing URL 2. ?
Detail
I'm deploying an application consisting of Next.js
, Firebase
and Sentry
to Vercel
.
In addition, I use Firebase App Check to make sure that Firebase storage
cannot be manipulated by anyone other than authorized domains.
And yesterday, when I installed Sentry, I had the following error in URL2.
@firebase/app-check: FirebaseError: AppCheck: Fetch server returned an HTTP error status. HTTP status: 403. (appCheck/fetch-status-error).
The URL in 2. is not allowed by App Check
, which is probably causing the above error.
Also, the above error occurs once per 15 to 30 minutes.
The error is caused by the following execution environment.
I don't know if it's Google's crawler or what, but there's something running around.
I want to redirect this guy running around who came to URL 2. to URL 3.
The URLs in 1. 2. 3. have canonical
set in the head as shown below.
<link rel="canonical" href="https://[myDomain].com">
However, the noindex
is not included in the head tags of pages 1. and 2.