Tutorials

Working with HTTP authentication

If you want to edit pages that require HTTP authentication to access, you’ll need to update your .htaccess file to let Surreal view them. The following configuration is a basic example of how to do this.

AuthType Basic
AuthName "Please enter your password"
AuthUserFile /path/to/.htpasswd

Require valid-user
Order deny,allow
Deny from all

# Surreal CMS
Allow from 45.55.90.199

Satisfy Any

Load balancers and HTTP proxies

Some cloud hosting providers use load balancers or proxies whose IP address will be passed to the server instead of our IP address. In this case, there’s usually a header called X-Forwarded-For that stores the requesting IP. For these cases, the following configuration should work:

# Surreal CMS V5
SetEnvIf X-Forwarded-For "45.55.90.199" AllowIP

AuthType Basic
AuthName "Please enter your password"
AuthUserFile /path/to/.htpasswd

Require valid-user
Order deny,allow
Deny from all

Allow from env=AllowIP

Satisfy Any