New Features¶ ↑
-
A redirect_http_to_https plugin has been added, redirecting HTTP requests to the same path on an HTTPS site. Using the routing tree, you can control where to do the redirection, which allows you to easily have part of your site accessible via HTTP, with sensitive sections requiring HTTPS:
plugin :redirect_http_to_https route do |r| # routes available via both HTTP and HTTPS r.redirect_http_to_https # routes available only via HTTPS end
If you want to redirect to HTTPS for all routes in the routing tree, you can have r.redirect_http_to_https as the very first method call in the routing tree. Note that in
Roda
it is possible to handle routing before the normal routing tree using before hooks. The static_routing and heartbeat plugins use this feature. If you would like to handle routes before the normal routing tree, you can setup a before hook:plugin :hooks before do request.redirect_http_to_https end