Home Heroku (PlayFramework/Scala) app automatically redirect to https
Reply: 0

Heroku (PlayFramework/Scala) app automatically redirect to https

user842
1#
user842 Published in June 19, 2018, 6:22 pm

I have an PlayFramework App developed using Scala running on Heroku; I only mention the development language and framework because any posts I've found regarding this issue relate to PHP! I have http and https running on a custom domain but I would like to force http requests to be redirect to https.

I've found that I need to update the .htaccess file with the following:

##Force SSL 

#Normal way (in case you need to deploy to NON-heroku)
RewriteCond %{HTTPS} !=on

#Heroku way
RewriteCond %{HTTP:X-Forwarded-Proto} !https 

#If neither above conditions are met, redirect to https
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

But I am not sure if it is possible or how to set up the .htaccess file using Play and Scala.

Please can someone advise? Thanks.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.327934 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO