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:
- Create a file named
auth-routes.txt
in the root folder and ensure that this file is included on the built site. - 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