A load balancer created with
datumctl alb create forces HTTPS by default, because the command adds a redirect rule like the one on this page. An HTTPProxy that you write yourself doesn’t redirect unless you add the rule. This guide applies when you manage the HTTPProxy directly, or when you need a custom redirect — for example, from a specific path or with a different status code.The rule matches only requests whose x-forwarded-proto header is http. The load balancer listens on both HTTP and HTTPS, so a rule that matched every request would also redirect HTTPS requests to themselves.Overview
ARequestRedirect filter responds to the client with a redirect response directly — no backend is reached. The Application Load Balancer handles the redirect at the proxy layer.
At a high level, this setup:
- Matches all incoming requests on a hostname
- Returns a
301 Moved Permanentlyredirect to the same URL usinghttps
Prerequisites
datumctlinstalled and authenticated- A valid Project
- An existing
HTTPProxyhostname, or create a new one with this guide
Configuration Steps
Step 1: Set Variables
- macOS / Linux
- Windows (PowerShell)
Step 2: Apply the Redirect Configuration
TheRequestRedirect filter requires type: RequestRedirect. No backend is needed — the redirect is returned immediately by the proxy.
- macOS / Linux
- Windows (PowerShell)
Verification
Test that a plain HTTP request receives a redirect:Location header uses https and preserves the path.
Cleanup
- macOS / Linux
- Windows (PowerShell)
Troubleshooting
Best Practices
- Use
statusCode: 301for permanent redirects — browsers and crawlers cache these - Use
statusCode: 302only when the redirect is temporary (e.g., maintenance) - If redirecting to a different hostname, set
requestRedirect.hostnameexplicitly rather than relying on theHostheader
Summary
- HTTP to HTTPS redirects use
type: RequestRedirectwithscheme: https - The
typefield is required on all filters - No backend is needed —
RequestRedirectis a terminal filter that responds to the client directly statusCodeaccepts301,302,303,307, or308, and defaults to302