title: HTTP to HTTPS redirection not working on AWS ALB
body: <p>I am using ECS for WordPress site and using Application Load Balancer (ALB) for load balancing and offloading SSL. ALB is using 2 different listeners on both port 80 and 443. The redirection rule is attached to the port 80 listener which is: </p>
  
  <pre><code>Redirect tohttps://#{host}:443/#{path}?#{query} 
  Status code:HTTP_301
  </code></pre>
  
  <p>The webserver is nginx with php-fpm and listening on port 80. There is no redirection being done at nginx.</p>
  
  <p>So, basically what I want is http (user req) -> https (ALB redirection) -> http (nginx)</p>
  
  <p>Now the problem is that the ALB is not redirecting the http traffic for the main home page like </p>
  
  <p><a href="http://example.com" rel="noreferrer">http://example.com</a> -> <a href="http://example.com" rel="noreferrer">http://example.com</a> (ALB no redirection) -> <a href="http://example.com" rel="noreferrer">http://example.com</a> (nginx)</p>
  
  <p>but it works with the same domain but different URL like:</p>
  
  <p><a href="http://example.com/page" rel="noreferrer">http://example.com/page</a> -> <a href="https://example.com/page" rel="noreferrer">https://example.com/page</a> (ALB redirection) -> <a href="http://example.com/page" rel="noreferrer">http://example.com/page</a> (nginx)</p>
  
  <p>Edit:
  Here is the <a href="https://imgur.com/a/0eLJ0BI" rel="noreferrer">link</a> to the ALB listener rules. </p>