module Roda::RodaPlugins::RedirectHttpToHttps
def self.configure(app, opts=OPTS)
- and other request methods with a 307 status.
uses a hash that redirects GET and HEAD requests with a 301 status,
:status_map - A hash mapping request methods to response status codes. By default,
so that it will implicitly use the HTTPS default port of 443.
:port - The port to use in the redirect. By default, will not set an explicit port,
arbitrary Host headers can be submitted to the application.
requested to. It is highly recommended that you set this if requests with
:host - The host to redirect to. If not set, redirects to the same host as the HTTP
no additional headers are set, the only header used is the Location header.
:headers - Any additional headers used in the redirect response. By default,
:body -
The body used in the redirect. If not set, uses an empty body.
Configures redirection from HTTP to HTTPS. Available options:
- Any additional headers used in the redirect response. By default,
- The host to redirect to. If not set, redirects to the same host as the HTTP
- The port to use in the redirect. By default, will not set an explicit port,
- A hash mapping request methods to response status codes. By default,
def self.configure(app, opts=OPTS) previous = app.opts[:redirect_http_to_https] || DEFAULTS opts = app.opts[:redirect_http_to_https] = previous.merge(opts) opts[:port_string] = opts[:port] ? ":#{opts[:port]}".freeze : "".freeze opts[:prefix] = opts[:host] ? "https://#{opts[:host]}#{opts[:port_string]}".freeze : nil opts.freeze end