Application Load Balancer — redirect HTTP to HTTPS

Intermediate
⏱️ 7 min read
📚 Updated: Aug 2025
ALB / TLS / Route 53

What you’ll learn

After you attach an ACM certificate to an HTTPS listener on your Application Load Balancer, you still receive plain HTTP on port 80 unless you close or redirect it. This guide edits the HTTP listener default rule so browsers receive a redirect to HTTPS instead of serving duplicate content on two schemes.

Complete the ACM walkthrough first if you have not yet validated DNS and enabled port 443.

Prerequisites

  • An AWS account with access to EC2 (load balancers) and Route 53.
  • An internet-facing Application Load Balancer already associated with your hosted zone (or ready to receive DNS).
  • A public ACM certificate on an HTTPS listener on port 443 that forwards to your target group (see ACM on ALB).
  • An HTTP listener on port 80 you can edit (this becomes the redirect entry point).

Configure the HTTP listener redirect

In the EC2 console, open Load Balancers, select your ALB, then the Listeners and rules tab.

  1. Select the HTTP:80 listener.

    ALB listeners and rules tab with HTTP port 80 listener
    Elastic Load Balancing
  2. Under Rules, open the default rule (or the catch-all you use for plain HTTP). Choose ActionsEdit rule (wording may read Edit depending on console version).

    Edit default rule on HTTP listener port 80
    Elastic Load Balancing
  3. Change the default action from Forward to target group to Redirect to URL. Set Protocol to HTTPS, Port to 443, and choose an appropriate HTTP status (commonly 301 permanent once you are sure). Use placeholders for host, path, and query so the redirect mirrors the incoming request.

    ALB rule editor redirect to HTTPS listener details
    Elastic Load Balancing
  4. In the redirect URL fields, prefer #{host} for the host, #{path} for the path, and #{query} for the query string (per current ALB documentation) instead of typing a single marketing domain.

    ALB redirect URL configuration with host path query parts
    Elastic Load Balancing
  5. Save changes. Wait for the listener state to return to active before testing.

Security groups for the load balancer

Clients must reach the ALB on both TCP 80 (for the redirect response) and TCP 443 (for the TLS site). In the EC2 console, open the security groups attached to the load balancer (shown on the ALB Description tab) and confirm inbound rules allow the required CIDR ranges—often 0.0.0.0/0 for public sites, tightened later with WAF or IP allow lists.

  1. Open EC2 → Load Balancers, select your ALB, and copy the security group IDs from the Description tab.
  2. Open EC2 → Security Groups, select each ALB security group, and under Inbound rules ensure HTTP (80) and HTTPS (443) are permitted from the sources you intend.

Test the redirect

  1. Open a browser or use curl -I http://your-domain.example.
  2. Confirm you receive a 301 or 302 with a Location: header pointing at https:// on the same host and path.
  3. Load the HTTPS URL and verify the certificate is valid for your hostname.

    Browser address bar showing HTTPS for the site
    Browser

Key takeaways

1

Move the HTTP:80 default action to a redirect toward HTTPS:443 once TLS is healthy.

2

Use ALB placeholders for host, path, and query so every hostname upgrades correctly.

3

Keep ALB security groups aligned with 80 and 443 while you rely on redirects and TLS.

Frequently asked questions

If you delete the HTTP listener, many clients that type http:// will fail instead of being upgraded. Keeping port 80 with a redirect is the usual pattern for public sites.
Yes. Ensure the HTTPS listener forwards to targets and does not redirect back to HTTP. Test with curl verbose output or browser devtools network panel when you change rules.
If viewers hit CloudFront first, you often terminate TLS and enforce HTTPS at the CDN, then connect to the origin over HTTPS. The ALB redirect pattern still matters for direct ALB access and for origins behind CloudFront when you allow HTTP from the CDN only.

Next: Route 53 DNS

Publish alias or CNAME records so clients reach your load balancer on both apex and www hostnames.

Amazon Route 53 (DNS) →
Did you know?

Prefer preserving the incoming host with placeholders such as #{host} in redirect rules instead of hardcoding a bare domain, so apex and subdomains continue to work as you add more hostnames behind the same load balancer.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful