Class: Safire::Middleware::HttpsOnlyRedirects
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- Safire::Middleware::HttpsOnlyRedirects
- Defined in:
- lib/safire/middleware/https_only_redirects.rb
Overview
Faraday middleware that blocks redirects to non-HTTPS URLs.
Sits inside the follow_redirects middleware’s app stack so it sees every intermediate 3xx response before the redirect is followed. HTTP redirects to localhost/127.0.0.1 are allowed (consistent with ClientConfig’s localhost exception for local development).
Constant Summary collapse
- LOCALHOST =
%w[localhost 127.0.0.1].freeze
Instance Method Summary collapse
Instance Method Details
#call(env) ⇒ Object
15 16 17 18 19 |
# File 'lib/safire/middleware/https_only_redirects.rb', line 15 def call(env) @app.call(env).on_complete do |response_env| check_redirect_safety!(response_env) end end |