Class: GovukProxy::StaticProxy
- Inherits:
-
Rack::Proxy
- Object
- Rack::Proxy
- GovukProxy::StaticProxy
- Defined in:
- lib/govuk_app_config/govuk_proxy/static_proxy.rb
Instance Method Summary collapse
Instance Method Details
#perform_request(env) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/govuk_app_config/govuk_proxy/static_proxy.rb', line 5 def perform_request(env) request = Rack::Request.new(env) # use rack proxy to forward any requests for /assets/static/* # this regex needs to match the path set for `Rails.application.config.assets.prefix` in Static # https://github.com/alphagov/static/blob/main/config/initializers/assets.rb if request.path =~ %r{^/assets/static/} env["HTTP_HOST"] = @backend.host super(env) else @app.call(env) end end |