Password protection

Published

Updated

🔒

Control public access with authentication.

Password protection puts HTTP basic authentication in front of a whole fortrabbit environment. Visitors need a username and password before any page loads, which keeps staging and development URLs private.

With password protection on, the browser asks for a username and password before it shows any page, asset or API response of the environment. It applies to every domain routed to the environment. The usual cases are staging environments, client previews and work in progress that search engines should not index.

Configuration

  • Switch: turns the protection on and off. The username and password stay stored while it is off.
  • Username and password: independent of any fortrabbit account. Each environment has its own.

Basic auth on the web server

The web server checks the credentials before the app runs, using HTTP basic authentication:

  • The browser shows its own login dialog and keeps the credentials for the session.
  • Search engines get no access, so the environment is not indexed.
  • Basic auth keeps out casual visitors. It is no replacement for a login in the app.

While protection is on, the Authorization header carries the basic auth credentials. An app that expects its own Authorization: Bearer token needs that token in a different header.

Alternatives

Basic auth can also be configured in .htaccess, for example to protect one folder only. Turn the dashboard setting off for that: the two do not combine. Some CMS offer settings or plugins for the same.

Written by humans and AI in collaboration.

AI use & editorial processEdit on GitHub ↗