Choosing which pages require authentication on your site

Last modified: August 30th, 2024

Auth routes allow you to specify the routes you want to be authenticated and keep the rest public. By default, all routes are authenticated.

For example, you may want to hide a 'staff-only' section of your site behind password authentication.

To specify custom authenticated routes for your site:

  1. Create a file named auth-routes.txt in the root folder and ensure that this file is included on the built site.
  2. Add the routes you want to this file, one on each line.

CloudCannon supports wildcards, allowing you to specify child folders or multiple files.

In the following example, visitors will have to log in to access /internal-news.html and anything inside /staff. Everything else is public.

auth-routes.txt
copied
/internal-news.html
/staff/*

Related Articles

Open in a new tab