If your app requires an "all-ssl" redirect using apache mod_rewrite alone and is hosted on Heroku, here is a reference implementation that works.