Play Framework Filter for AWS Elastic Load Balancer (forward HTTP to HTTPS)
Here is an example of how to forward HTTP to HTTPS using Play Framework Filter. This is a setup for AWS Elastic Load Balancer. A few points:
This is for Play Framework 2.2.x, the API is a bit different for older versions of Play. Scala Filters
Play lower-cases the headers thus we have "x-forwarded-proto" - this is inserted by the AWS Elastic Load Balancer. Some docs from AWS, x-forwarded.
Using HTTP Strict Transport Security (HSTS) by setting "Strict-Transport-Security" in the response header. You can read more about it here HSTS.