How to fix “Blocked due to unauthorized request (401) / access forbidden (403)” on Next.js
If Search Console shows “Blocked due to unauthorized request (401) / access forbidden (403)” on your Next.js site, you are in the right place. Googlebot could not read the page because it asked for login or access was denied. This page covers the causes and a step-by-step fix for Next.js. A React framework. Server-side and static generation hand Googlebot ready-made HTML; metadata is managed with the Metadata API.
Contents
What does this status mean?
The server answered Googlebot with 401 (login required) or 403 (forbidden). Googlebot does not log in, so the page cannot be indexed.
Likely causes on Next.js
- The page is members-only or password-protected.
- A firewall, WAF or bot protection blocks Googlebot IPs.
- A country or IP restriction covers Google IPs.
- A hotlink or user-agent rule rejects Googlebot.
- Next.js note: Check app/robots.ts or public/robots.txt. If you disallow preview environments, confirm the same rule does not ship to production.
Step-by-step fix on Next.js
- In your Next.js admin go to: The metadata object in app/layout.tsx and page files, app/robots.ts, app/sitemap.ts and next.config.js.
- Check app/robots.ts or public/robots.txt. If you disallow preview environments, confirm the same rule does not ship to production.
- Render pages statically or with ISR where possible, split heavy client bundles and use next/image. Slow server responses reduce crawl rate.
- If the page should be public, remove the protection; if it should stay private this line is expected.
- Allow-list Googlebot as a verified crawler in the WAF and firewall.
- Allow Googlebot by verifying with reverse DNS rather than trusting the user agent.
- Confirm the response code with a live test in URL inspection.
- After fixing, start validation and send the URL.
Extra checks for Next.js
- noindex and visibility: Look for robots: { index: false } in metadata; a condition tied to an environment variable can output noindex in production by mistake. Also check that no X-Robots-Tag response header is added.
- canonical and duplicate URLs: Give every page an absolute canonical with metadata.alternates.canonical and set metadataBase. On dynamic routes make sure parametrised URLs do not repeat content.
After fixing
In Search Console start "Validate fix" for this status and resubmit the page with URL inspection. First confirm the blocker is gone with the free Free indexability checker tool; for many URLs follow Bulk URL indexing: how to send thousands of pages to Google. Google makes the indexing decision itself and timing ranges from days to weeks.
More information
Frequently asked questions
Can Google see members-only content?
No. Previews need structured data and paywalled-content markup.
How do I tell if I am blocking Googlebot?
Look for 403 entries for Googlebot requests in your firewall logs.
Where are these settings on Next.js?
The metadata object in app/layout.tsx and page files, app/robots.ts, app/sitemap.ts and next.config.js.
Related pages
- Next.js: URL is unknown to GoogleFixes
- Next.js: Indexed, not submitted in sitemapFixes
- Next.js: Crawled - currently not indexedFixes
- React SPA: Blocked due to unauthorized request (401) / access forbidden (403)Fixes
- Laravel: Blocked due to unauthorized request (401) / access forbidden (403)Fixes
- Ghost: Blocked due to unauthorized request (401) / access forbidden (403)Fixes