I have a Laravel 5 build running on an apache Heroku instance and I am trying to make sure all traffic is converted through https, however I am desperately lost.
I have the SSL certificate up and running successfully. However with Heroku you cannot edit the .htaccess file on their server directly. So their recommendation on this page is to set up an apache_app.conf and tell Heroku to read it by putting this in the Procfile:
web: vendor/bin/heroku-php-apache2 -C apache_app.conf public/
However when I do this, pretty much any kind of HTTPS rewrite rules I add cause a redirect loop or an application error. Here is my current configuration:
RewriteEngine on
#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]