Secure The Edge (WAF)
Set up Basic Auth
The documentation only applies to instances deployed on Alokai@Edge.
Basic Authentication (Basic Auth) lets you protect your instance with a username and password. It is useful for restricting access to staging environments, development previews, or internal projects before going live.
How it works
When Basic Auth is enabled:
- Incoming requests must include an
Authorizationheader with valid credentials - Credentials are validated against your configured username/password pairs
- After successful validation, the
Authorizationheader is removed from the request before it reaches your application - An
Auth-Userheader containing the authenticated username is added to the request
This ensures credentials are not exposed to your application or logged downstream.
Configuration
General behavior
- You can add multiple credentials (username + password pairs).
- Basic Auth can be enabled or disabled at any time.
- Without at least one credential, Basic Auth cannot be enabled.
- Credentials can be edited or removed after being added.
- Enabling Basic Auth also affects Commerce Intelligence and Performance Audits — automated audits cannot run while Basic Auth is active.
Basic Auth & other security features
Order of processing security features
Security feateures processing sequence is describled in separete document.
Basic Auth & CDN
CDN caching works with Basic Auth enabled. Authentication is validated at the edge, and the Authorization header is removed before the response is cached. All authenticated users share the same cached response.
When Basic Auth is active:
- All requests must include valid credentials (username + password), except for requests coming from IPs on the Allowed list.
- CDN caching applies — responses are cached at the edge after authentication validation. The Authorization header is stripped before cache lookup, so the cache key is based on URL alone.
- Performance audits cannot be conducted, since automated tools cannot bypass authentication.
When Basic Auth is disabled:
- If CDN was previously enabled, caching behavior remains unchanged.