Choosing which pages require authentication on your site

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
  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
/internal-news.html
/staff/*
Was this article helpful? or Suggest an improvement >

Related articles