Web and technology

Cloudflare Access: protect your test site with a PIN

By Edgar Jaimes 4 min read

Person using a laptop and a cell phone on a wooden table in an office

How to use Cloudflare Access so only your team can see the test site or a dashboard: policies, email PIN, common mistakes and steps for Pages.

Your agency sends you the link to the new site so you can approve it. You forward it to your partner and, without meaning to, to a vendor as well. Two weeks later, the design with the launch price is circulating in a chat you do not control.

Cloudflare Access makes a web address open only if the person proves they are authorized.

What is Cloudflare Access and what is it for in a small business?

It is the Cloudflare service that decides who can reach an application, applying policies that you define. According to the Access policies documentation, policies apply to SaaS, self-hosted and non-HTTP applications. For a small business it means protecting the site under construction, an internal dashboard, a report or a tool that should not be public, without setting up servers or a VPN.

Illuminated electronic schematic on a dark glass panel, representing access rules
An Access policy works as a set of rules: whoever meets them gets in, whoever does not stays out. Photo: Unsplash

How do Access policies work?

Each policy has a single action and rules that define who it applies to. Access is denied by default: if no policy allows you, you do not get in. These are the actions, according to the same documentation:

ActionWhat it does
AllowLets in whoever meets the criteria
BlockStops access; mostly used to carve exceptions out of an Allow
BypassTurns off Access for that traffic and does not log the requests
Service AuthRequires non-person identity methods, such as service tokens or mTLS, and keeps the log

Rules are combined with three types: Include acts as “or” (at least one is needed), Require as “and” and Exclude as “not”. Also, Bypass and Service Auth are evaluated first, and then Allow and Block from top to bottom, with the first match as the final decision.

Common mistake: using “One-time PIN” as the only Include rule. Cloudflare lists it as a frequent misconfiguration, because it lets in anyone who validates an email. Always limit by specific emails or by your company domain.

How does the email PIN work?

Cloudflare sends a one-time code to the person's email, which expires in 10 minutes. According to the one-time PIN documentation, requesting a new code invalidates the previous one, and the email is only sent to addresses allowed by a policy. Someone who is not authorized receives nothing, but the screen still says a code was sent.

If your company email has strict filters and the code does not arrive, Cloudflare recommends allowing the notify.cloudflare.com domain in your email filters. If you see “This One-Time PIN has already been used”, it is usually a security filter that opened the link before you did: request another code. If your corporate email fails for other reasons, check SPF, DKIM and DMARC.

How do I protect Cloudflare Pages previews?

In your project dashboard, go to Settings, General and turn on “Enable access policy”. According to the preview deployments documentation, previews are public by default and, once you turn on the policy, only your Cloudflare account can view them. For your team to see them, add members to the account.

Server cabinets with colorful cables and green lights in a dark data center
Behind every site there is infrastructure: deciding who reaches it is part of security. Photo: Unsplash

Heads up: that policy covers only previews. Cloudflare clarifies that it does not protect your *.pages.dev domain or your own domain. For those cases, its Pages known issues describe extra steps in Zero Trust, and if you skip the policy for your own domain, the access screen appears but does not work for your visitors.

If you want to understand what else the free plan includes, review the Cloudflare Pages limits.

Does Access replace the WAF or noindex?

No: each one solves a different problem. Noindex asks Google not to show a page, but it does not stop anyone from opening the link; we explain it in the guide on HTTP headers on Cloudflare Pages. The WAF filters malicious traffic going to a public site, as the guide on WAF rules and Bot Fight Mode explains. Access, on the other hand, closes the door on anyone without permission. For something that must never be public, use Access; for your sales site, WAF and good practices.

In short

That accidentally forwarded link is avoided with a policy: deny by default, Allow for specific emails and a 10-minute PIN. In Pages, turn on the previews policy and remember that your main domain needs separate steps. If you would rather have us set it up, check out our hosting and domains service.

Frequently asked questions

What is Cloudflare Access?

It is the Cloudflare service that controls who can reach an application through policies. According to the documentation, it applies to SaaS, self-hosted and non-HTTP applications.

How long does the one-time PIN last?

According to Cloudflare, each PIN expires 10 minutes after you request it, can be used only once, and requesting a new one invalidates the previous one.

Is my main domain protected when I turn on the policy in Pages?

No. Cloudflare says that policy covers only preview deployments. Protecting the pages.dev domain or your own domain takes extra steps in Zero Trust.

What happens if an unauthorized email requests a PIN?

It receives no email, but the access screen still shows the notice that a code was sent.

What is the Bypass action for?

It turns off Access for matching traffic and does not log the requests. Cloudflare does not recommend it for internal applications.

Do not stop at the theory: apply it to your business

We implement hosting and domains end to end, with your real operation. The first conversation is free.

Keep reading