Fix Page with Redirect: A Solution for Vercel + Cloudflare Users
Introduction
If you're using Vercel to deploy your Next.js app and Cloudflare to manage your DNS, you might have encountered a frustrating error in Google Search Console:
Page is not indexed: Page with redirect
In this article, we'll explore a potential solution to address this issue and ensure that your pages get indexed properly.
Understanding the Redirect Issue
At first, the cause of the redirect issue might not be immediately clear. You might suspect that the force HTTPS setting in Cloudflare is causing the problem. However, disabling this option doesn't resolve the issue.
Identifying the Correct Setup
During my investigation, I stumbled upon an informative article on Vercel's website that provides guidance on setting up Cloudflare with Vercel. Unfortunately, it seems that my setup was already correct according to their recommendations.
The Solution
To address the page indexing problem, follow these steps:
-
Check SSL/TLS Encryption Settings in Cloudflare: Ensure that your SSL/TLS encryption mode is set to "Full" or "Full (strict)" in Cloudflare. This ensures a secure connection between the client and your website.
-
If Always Use HTTPS is enabled under the Edge Certificates, this will prevent Vercel from detecting the site is configured correctly. Vercel automatically redirects HTTP traffic at platform level and therefore should be disabled on Cloudflare's side.
-
Disable the Default Redirect in Vercel: Access your Vercel dashboard and locate the custom domain settings. By default, Vercel automatically redirects
www.example.com
toexample.com
. This redirection is the root cause of the indexing issue. To fix it, disable the redirect from thewww
version to the non-www
version.
Once you've completed these steps, your pages should be ready for indexing. Keep in mind that it may take a few days for Google to reindex your pages. However, if you prefer, you can also manually request a reindexing through Google Search Console.
Do you have any suggestions, questions, or feedback that you would like to share?