Configure authenticated routes

Last modified: February 3rd, 2025

This feature is only available for Sites hosted through CloudCannon. If you host your Site externally, or use CloudCannon in Headless Mode, this feature will not work.

An authenticated route is a URL that requires visitors to authenticate their identity before they can see the content.

When you enable password authentication, enable user account authentication, or enable SAML authentication, CloudCannon requires authentication on all routes by default. However, you can specify authenticated routes to require authentication for specific parts of your Site. For example, you could require password authentication for a "Staff Only" section of your website while the other pages remain publicly available.

You can specify which routes should use authentication in an auth-routes.txt file. This file should be in the root directory of your output Site. Where this is in your Site repository will depend on your SSG (e.g., the root of the repository for Jekyll, the static folder for Hugo, etc.).

To specify authenticated routes:

  1. Navigate to the root directory of your output Site using the File browser.
  2. Create a file called auth-routes.txt.
  3. For each URL you want to authenticate, add the route on a new line of the file.
  4. Save your page to your Site.
  5. Navigate to the Authentication page under Site Settings.
  6. Enable password, user account, or SAML authentication.

CloudCannon will apply the authentication method you select to the routes specified in the auth-routes.txt file.

You can use the * character in a route to specify multiple subfolders or files.

Here is an example of a basic authenticated routes file:

auth-routes.txt
copied

/internal-news.html
/staff/*

Related Articles

Open in a new tab