I\'m looking to learn how to cleanup my app\'s URLs. My app is powered by Rails 3 on Heroku.
The desired URL is https://www.example.comite.com
I
Because this is Heroku, you cannot use apache or nginx configs. What you can do is put a before_filter in your ApplicationController, assuming you have 3 or more controllers like these below, although of course they will be in separate files
class ApplicationController < ActionController::Base
def redirect_https
redirect_to :protocol => "https://" unless request.ssl?
return true
end
before_filter :redirect_https
end
class TypicalController < ApplicationController
def blah
end
end
class HomePageController < ApplicationController
skip_before_filter :redirect_https
end
You may also need to fiddle your routes a bit when using devise, but I suspect that was just the way we did it so I won't get into those details here, and I've modified the code above to avoid that complication.
happy hacking.