This guide describes how to configure HTTP Basic Authentication for applications running behind a Datum gateway usingDocumentation Index
Fetch the complete documentation index at: https://datum-4926dda5-how-to-guides-gateway-auth.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
datumctl. The configuration uses Envoy Gateway SecurityPolicy resources and applies to Windows, macOS, and Linux.
Overview
HTTP Basic Authentication protects an application by requiring a username and password before requests are forwarded to the origin. At a high level, this setup:- Generates credentials in htpasswd (SHA) format
- Stores credentials in a Kubernetes Secret
- Labels the Secret so it is synced to edge clusters
- Attaches a SecurityPolicy to an
HTTPRoute - Verifies authentication behavior
Prerequisites
datumctlinstalled and authenticated- A valid Project
- Existing:
GatewayHTTPRoute
- Permission to create:
SecretSecurityPolicy
Critical Requirement: Secret Syncing
Secrets and ConfigMaps referenced by gateway configurations are not automatically synced to edge clusters. To make a Secret available to edge gateways, it must include the following label:Why This Matters
- Without this label, the gateway receives the policy but not the Secret
- Envoy fails to load the Basic Auth credentials
- All requests return HTTP 500 instead of a login prompt
Configuration Steps
Step 1: Set Variables
Windows (PowerShell)
macOS / Linux
Step 2: Generate htpasswd Entry (SHA)
Envoy Gateway currently supports SHA-based htpasswd entries only. Other formats (bcrypt, APR1) are not supported and will cause failures.Windows (PowerShell)
macOS / Linux
Step 3: Create the Secret
The Secret must:- Use the key
.htpasswd - Exist in the same namespace as the
SecurityPolicy - Include the gateway-sync label
Windows (PowerShell)
macOS / Linux
Step 4: Attach Basic Auth Using a SecurityPolicy
Attach the policy to the HTTPRoute. This is the most reliable attachment point.Windows (PowerShell)
macOS / Linux
Verification
Unauthenticated Request
Authenticated Request
Cleanup / Disable Basic Auth
Windows (PowerShell)
macOS / Linux
Troubleshooting
Common Failure Modes
| Symptom | Root Cause | Resolution |
|---|---|---|
| HTTP 500 on all requests | Secret not synced to edge | Add gateway-sync label |
| 500 even with credentials | Secret missing at edge | Re-apply Secret with label |
| No login prompt | Policy not attached | Verify targetRefs |
| Works after deleting policy | Invalid Secret reference | Fix Secret and label |
Useful Debug Commands
Best Practices
- Use Basic Auth for development, demos, and staging environments
- Rotate credentials regularly
- Store credentials securely using CI secrets or a secret manager
- Use JWT, OIDC, or SSO for production authentication
Summary
- HTTP Basic Auth is configured using Envoy Gateway
SecurityPolicy - Secrets must be explicitly synced to edge clusters using the
gateway-synclabel {SHA}htpasswd format is required — bcrypt and APR1 are not supported- Attaching policies to
HTTPRouteis the most reliable approach