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"]
May be you have to write another tiny application, listening on http port and issuing Location header to any incoming request?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With