works on heroku. NOTE: you need to set up var on heroku like HOSTNAME=yourapp.com