Module: Falcon::Environment::Redirect
- Includes:
- Server
- Defined in:
- lib/falcon/environment/redirect.rb
Overview
Provides an environment for redirecting insecure web traffic to a secure endpoint.
Instance Method Summary collapse
-
#environments ⇒ Object
The services we will redirect to.
-
#hosts ⇒ Object
Build a hash of host authorities to their evaluators for redirect matching.
-
#middleware ⇒ Object
Load the Middleware::Redirect application with the specified hosts.
-
#redirect_endpoint ⇒ Object
Parse the redirect URL into an endpoint.
-
#redirect_url ⇒ Object
The URL template to redirect to.
Methods included from Server
#authority, #cache, #client_endpoint, #endpoint, #endpoint_options, #make_server, #service_class, #timeout, #url, #verbose
Instance Method Details
#environments ⇒ Object
The services we will redirect to.
30 31 32 |
# File 'lib/falcon/environment/redirect.rb', line 30 def environments [] end |
#hosts ⇒ Object
Build a hash of host authorities to their evaluators for redirect matching.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/falcon/environment/redirect.rb', line 36 def hosts hosts = {} environments.each do |environment| evaluator = environment.evaluator if environment.implements?(Falcon::Environment::Application) Console.info(self){"Redirecting #{self.url} to #{evaluator.}"} hosts[evaluator.] = evaluator end end return hosts end |
#middleware ⇒ Object
Load the Middleware::Redirect application with the specified hosts.
52 53 54 |
# File 'lib/falcon/environment/redirect.rb', line 52 def middleware Middleware::Redirect.new(Middleware::NotFound, hosts, redirect_endpoint) end |
#redirect_endpoint ⇒ Object
Parse the redirect URL into an endpoint.
24 25 26 |
# File 'lib/falcon/environment/redirect.rb', line 24 def redirect_endpoint Async::HTTP::Endpoint.parse(redirect_url) end |
#redirect_url ⇒ Object
The URL template to redirect to.
18 19 20 |
# File 'lib/falcon/environment/redirect.rb', line 18 def redirect_url "https://[::]:443" end |