Skip to main content

Redirect to HTTP behind load balancer (apart from localhost) with URL rewrite

Just a short "note to self for future" post as found a few variations for part of this online but needed to pull them together.

Requirement is:

  • Ensure all HTTP requests are redirected to HTTPS
  • Handle the fact that the web server is behind a load balancer that terminates HTTPS
  • Allow for local HTTP requests via a custom port