I'm using flexible environment on Google App Engine to run web app written in Scala and Play Framework. I've added custom domain to my application and now my app is available both through http and https. But I need to make redirection from http to https. I've tried to manage it by doing the following, but it didn't work:
application.conf:
play.http.filters = "controllers.Filters"
controllers.Filters:
import javax.inject.Inject
import play.api.http.DefaultHttpFilters
import play.filters.cors.CORSFilter
import play.filters.https.RedirectHttpsFilter
class Filters @Inject() (corsFilter: CORSFilter, redirectHttpsFilter: RedirectHttpsFilter) extends DefaultHttpFilters(corsFilter, redirectHttpsFilter)
UPD Maybe the problem is that I need to specify https port in my Dockerfile? Here is a Dockerfile:
FROM gcr.io/google_appengine/openjdk
RUN wget http://downloads.lightbend.com/scala/2.11.8/scala-2.11.8.deb
RUN dpkg -i scala-2.11.8.deb
RUN wget https://dl.bintray.com/sbt/debian/sbt-0.13.13.deb
RUN dpkg -i sbt-0.13.13.deb
RUN apt-get update
RUN apt-get install scala sbt
RUN rm -f scala-2.11.8.deb
RUN rm -f sbt-0.13.13.deb
ADD . /appname
WORKDIR /appname
RUN chmod 755 ./docker-entrypoint.bash
ENTRYPOINT ["./docker-entrypoint.bash"]
CMD ["./target/universal/stage/bin/appname", "-Dhttp.port=8080"]
package controllers
definition in yourFilters.scala
file I'm sure this is just missing from your snippet - you'd see a big warning at startup if thecontrollers.Filters
class isn't being found. Can you make a request with curl and show the output? Also, what happens if you write your own filter that runs beforeRedirectHttpsFilter
and prints out the value of the request'ssecure
field? – Madaras