401 and 403 errors
Last reviewed
A 401 from Prebaked means the token is missing or wrong. A 403 means the token is fine but Prebaked will not render this URL: the domain is not verified for that token, the call used plain http://, or the URL does not point to a public address. Each error comes with a short message in the response body that tells you which case it is.
Why crawlers may not show the error
The Cloudflare Worker, Netlify, Vercel and nginx integrations serve your own page when Prebaked answers 401 or 403. Crawlers then get your normal page, which may be an empty shell, and no error.
With Express and prerender-node, the 401 or 403 reaches the crawler unless you added the afterRender hook from the setup guide. Add it, then fix the cause below.
See the error yourself
Call the service directly with the token your integration uses:
curl -i -H "X-Prerender-Token: <your token>" \
https://service.prebaked.io/https://www.example.com/
Read the status line and the message in the body.
401: Missing or invalid X-Prerender-Token
Message: Missing or invalid X-Prerender-Token.
- No token sent. Check that the header is called
X-Prerender-Tokenand that the environment variable is set where the integration runs. For the Cloudflare Worker that is thePREBAKED_TOKENsecret. - Typo or extra characters. Copy the token again, without spaces or quotes.
- Old token. Creating a new token on the Setup page replaces the old one, and so does installing with Connect with Cloudflare. Put the new token into every integration that uses it.
Prebaked stores only a hash of each token, so it cannot show you an existing token again. If you lost it, create a new one on the domain's Setup page.
403: hostname not verified
Message: This hostname is not a verified domain of the account for this token. Verify the domain in the dashboard.
- The domain is not verified yet. Open Domains and finish verification.
- Verification lapsed. Prebaked checks every domain daily. After 7 failed checks in a row the domain goes back to unverified and you get an email. A removed DNS record or file is the usual cause.
- The token belongs to another domain. Each domain has its own token. The token for
example.comworks forexample.comandwww.example.com, but not forshop.example.comor another site. - A subdomain you did not add. Subdomains other than
www, such asapp.example.com, are separate domains. Add and verify them on their own.
403: HTTPS required
Message: HTTPS required: call the service over https://, plain http would send your token in clear text.
Your integration calls http://service.prebaked.io/. Change the service URL to https://service.prebaked.io/. Prebaked refuses plain http instead of redirecting, because a redirect would be passed on to the crawler.
403: URL not allowed
Message: This URL is not allowed (it does not resolve to a public address).
Prebaked only renders pages on public addresses. A hostname that points to a private, local or internal IP address is refused. Check the DNS records of the host you tested.
FAQ
Do crawlers see a 401 page on my site?
Not with the Cloudflare Worker, Netlify, Vercel or nginx integrations: they serve your own page instead. With Express, only if you have not added the afterRender hook.
Does the same token work for www and the apex?
Yes. example.com and www.example.com are one domain in Prebaked and share one token.
I lost my token. Can I see it again?
No. Prebaked stores only a hash of each token. Create a new one on the domain's Setup page and put it into every integration that uses the old one.