{"id":938,"date":"2026-10-16T15:54:40","date_gmt":"2026-10-16T07:54:40","guid":{"rendered":"https:\/\/vinta.ws\/code\/?p=938"},"modified":"2026-10-16T15:54:40","modified_gmt":"2026-10-16T07:54:40","slug":"use-cloudflare-access-to-protect-your-website-service-if-you-dont-bother-to-build-a-login-page","status":"publish","type":"post","link":"https:\/\/vinta.ws\/code\/use-cloudflare-access-to-protect-your-website-service-if-you-dont-bother-to-build-a-login-page.html","title":{"rendered":"Use Cloudflare Access to Protect Your Website\/Service If You Don't Bother to Build a Login Page"},"content":{"rendered":"<p>If you're too lazy to build an authentication system (aka a login page) for your website or service, try Cloudflare Access.<\/p>\n<p>With a few clicks, it can put a login page in front of your website or service as long as you host your domain on Cloudflare. Only the emails you allow can get in, everyone else is blocked at Cloudflare's edge before reaching your server.<\/p>\n<p>I use it as an extra layer of security to protect my WordPress blog logins, which were getting thousands of brute-force attempts a day. For example, I have a blog at <code>https:\/\/vinta.ws\/code\/<\/code>:<\/p>\n<h2>Configuration<\/h2>\n<p>Go to the Cloudflare dashboard &gt; Zero Trust:<\/p>\n<ul>\n<li>Integrations &gt; Identity providers &gt; Add new identity provider\n<ul>\n<li>Select <strong>One-time PIN<\/strong> or anything else you want to use as the login method<\/li>\n<\/ul>\n<\/li>\n<li>Access controls &gt; Applications &gt; Create new application &gt; Self-hosted and private\n<ul>\n<li>Destinations &gt; Public hostnames:\n<ul>\n<li>Domain: <code>vinta.ws<\/code>, Path: <code>code\/wp-login.php<\/code><\/li>\n<li>Domain: <code>vinta.ws<\/code>, Path: <code>code\/wp-admin<\/code><\/li>\n<li>Or any path you want to protect<\/li>\n<\/ul>\n<\/li>\n<li>Access policies &gt; Create new policy:\n<ul>\n<li>Action: Allow<\/li>\n<li>Include: Emails, <strong>your email<\/strong><\/li>\n<\/ul>\n<\/li>\n<li>Authentication &gt; Identity:\n<ul>\n<li>Select <strong>One-time PIN<\/strong><\/li>\n<li>Turn on <strong>Apply instant authentication<\/strong><\/li>\n<\/ul>\n<\/li>\n<li>Details:\n<ul>\n<li>Name: Whatever you like<\/li>\n<li>Session Duration: 24 hours<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>ref:<br \/>\n<a target=\"_blank\" href=\"https:\/\/developers.cloudflare.com\/cloudflare-one\/access-controls\/applications\/http-apps\/self-hosted-public-app\/\">https:\/\/developers.cloudflare.com\/cloudflare-one\/access-controls\/applications\/http-apps\/self-hosted-public-app\/<\/a><\/p>\n<p>Open the protected page in your browser, you will see Cloudflare's login page asking for your email.<\/p>\n<p>That's it. No code, no plugin, no installation, and free.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Put a login page in front of your website or service with a few clicks. Only the emails you allow can get in. No code, no plugin, no installation, and free.<\/p>\n","protected":false},"author":1,"featured_media":939,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38],"tags":[151,145],"class_list":["post-938","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-about-devops","tag-cloudflare","tag-security"],"_links":{"self":[{"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/posts\/938","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/comments?post=938"}],"version-history":[{"count":0,"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/posts\/938\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/media\/939"}],"wp:attachment":[{"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/media?parent=938"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/categories?post=938"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/tags?post=938"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}