Workers, Access - You can now enable Access on a Worker or all Workers at once
- Announced
- Tags
- Workers, Access
- Severity
- info, set by
reef/rss-rule-v1 - Source
- https://developers.cloudflare.com/changelog/post/2026-08-14-workers-access/
<p>You now have two new ways to protect your <a href="https://developers.cloudflare.com/workers/">Workers</a> with <a href="https://developers.cloudflare.com/workers/configuration/cloudflare-access/">Cloudflare Access</a>.</p> <p><strong>Protect an application across all its domains at once</strong></p> <p>Until now, if a Worker was reachable on a route, a Custom Domain, and a <code>workers.dev</code> URL, you had to manually add each one to an Access application and keep the list in sync whenever routes or domains changed.</p> <p>Now, Access attaches the policy to the Worker itself, so every associated domain and preview URL stays protected even when its routes or domains change.</p> <img src="https://developers.cloudflare.com/cdn-cgi/image/onerror=redirect,width=1476,height=689,format=webp/_astro/protect-one-worker.BSpeeOry.png" alt="Access setting for protecting a single Worker" loading="lazy" decoding="async" width="1476" height="689"> <p><strong>Protect all new and existing Workers by default</strong></p> <p>Make all Workers private by default, so every existing and newly created Worker requires sign-in before anyone can reach it.</p> <img src="https://developers.cloudflare.com/cdn-cgi/image/onerror=redirect,width=2436,height=1432,format=webp/_astro/protect-all-workers._AWy-S-E.png" alt="Account-wide Access setting that protects all Workers" loading="lazy" decoding="async" width="2436" height="1432"> <p>If a specific Worker should remain publicly accessible, add a Worker-level bypass to exempt it.</p> <img src="https://developers.cloudflare.com/cdn-cgi/image/onerror=redirect,width=1228,height=756,format=webp/_astro/make-worker-public.D3yjPjtf.png" alt="Make a Worker public when all Workers are protected" loading="lazy" decoding="async" width="1228" height="756"> <p>Whether you protect a single application or all Workers at once, you can choose whether to protect preview deployments only or both previews and production, and control who can sign in by Cloudflare account membership, email address, or email domain.</p> <p>For more advanced policy options, edit the policy in <a href="https://dash.cloudflare.com/?to=/:account/one/access/apps" target="_blank" rel="noopener">Zero Trust<span class="external-link"> ↗︎</span></a>.</p> <img src="https://developers.cloudflare.com/cdn-cgi/image/onerror=redirect,width=1276,height=1220,format=webp/_astro/choose-who-can-sign-in.DKf3kWAK.png" alt="Access policy configuration for controlling who can sign in" loading="lazy" decoding="async" width="1276" height="1220"> <p><strong>View all of your Worker Access policies</strong></p> <p>You can view and manage all of your Access policies in the <strong>Access</strong> tab of the Workers & Pages section in the dashboard.</p> <img src="https://developers.cloudflare.com/cdn-cgi/image/onerror=redirect,width=1646,height=1366,format=webp/_astro/access-policies.DN7yCwHX.png" alt="Access tab showing all configured Access policies" loading="lazy" decoding="async" width="1646" height="1366"> <p><strong>See who is accessing your Worker</strong></p> <p>When Access is enabled on your Worker, every authenticated request includes <code>ctx.access</code>. Call <a href="https://developers.cloudflare.com/workers/runtime-apis/context/#access"><code>ctx.access.getIdentity()</code></a> to get the user's email, name, and groups — no manual JWT validation required.</p> <figure class="nb-code-figure" data-nb-lang="js"><pre class="astro-code astro-code-themes github-light github-dark nb-shiki-c6xiwz" tabindex="0" data-language="js" data-nb-lang="js"><code><span class="line"><span class="nb-shiki-1itgoe">export</span><span class="nb-shiki-1itgoe"> default</span><span class="nb-shiki-140thh"> {</span></span> <span class="line"><span class="nb-shiki-1itgoe"> async</span><span class="nb-shiki-1t8gfj"> fetch</span><span class="nb-shiki-140thh">(</span><span class="nb-shiki-1jdh33">request</span><span class="nb-shiki-140thh">, </span><span class="nb-shiki-1jdh33">env</span><span class="nb-shiki-140thh">, </span><span class="nb-shiki-1jdh33">ctx</span><span class="nb-shiki-140thh">) {</span></span> <span class="line"><span class="nb-shiki-1itgoe"> if</span><span class="nb-shiki-140thh"> (</span><span class="nb-shiki-1itgoe">!</span><span class="nb-shiki-140thh">ctx.access) {</span></span> <span class="line"><span class="nb-shiki-1itgoe"> return</span><span class="nb-shiki-1itgoe"> new</span><span class="nb-shiki-1t8gfj"> Response</span><span class="nb-shiki-140thh">(</span><span class="nb-shiki-mdbnqw">"Access did not run"</span><span class="nb-shiki-140thh">, { status: </span><span class="nb-shiki-dzsirb">401</span><span class="nb-shiki-140thh"> });</span></span> <span class="line"><span class="nb-shiki-140thh"> }</span></span> <span class="line"></span> <span class="line"><span class="nb-shiki-1itgoe"> const</span><span class="nb-shiki-dzsirb"> identity</span><span class="nb-shiki-1itgoe"> =</span><span class="nb-shiki-1itgoe"> await</span><span class="nb-shiki-140thh"> ctx.access.</span><span class="nb-shiki-1t8gfj">getIdentity</span><span class="nb-shiki-140thh">();</span></span> <span class="line"><span class="nb-shiki-1itgoe"> return</span><span class="nb-shiki-140thh"> Response.</span><span class="nb-shiki-1t8gfj">json</span><span class="nb-shiki-140thh">({ aud: ctx.access.aud, email: identity?.email });</span></span> <span class="line"><span class="nb-shiki-140thh"> },</span></span> <span class="line"><span class="nb-shiki-140thh">};</span></span></code></pre></figure> <p><strong>Test Access locally</strong></p> <p>You can now test Cloudflare Access locally with <code>wrangler dev</code>. Add a <code>dev</code> block to your <code>wrangler.jsonc</code>:</p> <figure class="nb-code-figure" data-nb-lang="json"><pre class="astro-code astro-code-themes github-light github-dark nb-shiki-c6xiwz" tabindex="0" data-language="json" data-nb-lang="json"><code><span class="line"><span class="nb-shiki-140thh">{</span></span> <span class="line"><span class="nb-shiki-dzsirb"> "access"</span><span class="nb-shiki-140thh">: {</span></span> <span class="line"><span class="nb-shiki-dzsirb"> "dev"</span><span class="nb-shiki-140thh">: {</span></span> <span class="line"><span class="nb-shiki-dzsirb"> "aud"</span><span class="nb-shiki-140thh">: </span><span class="nb-shiki-mdbnqw">"my-app"</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-dzsirb"> "identity"</span><span class="nb-shiki-140thh">: { </span><span class="nb-shiki-dzsirb">"email"</span><span class="nb-shiki-140thh">: </span><span class="nb-shiki-mdbnqw">"admin@example.com"</span><span class="nb-shiki-140thh"> }</span></span> <span class="line"><span class="nb-shiki-140thh"> }</span></span> <span class="line"><span class="nb-shiki-140thh"> }</span></span> <span class="line"><span class="nb-shiki-140thh">}</span></span></code></pre></figure> <p>Your Worker will receive this identity through <code>ctx.access</code> and <code>ctx.access.getIdentity()</code>, letting you test authenticated and unauthenticated flows without deploying. Remove the <code>dev</code> block to simulate unauthenticated requests.</p> <p><strong>API and programmatic access</strong></p> <p>You can also set up these policies through the <a href="https://developers.cloudflare.com/workers/configuration/cloudflare-access/">Workers API</a> instead of the dashboard.</p>
The text above is the source's. reef added the severity, the dates it could read from the text, and the endpoints and scopes named in code.