Sha256: e071a88a26d1a9404dcfe8a90410f229e77cf54a5c98a2c7ab02c049c80363f7

Contents?: true

Size: 564 Bytes

Versions: 55

Compression:

Stored size: 564 Bytes

Contents

require "rack-proxy"

module GovukProxy
  class StaticProxy < Rack::Proxy
    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
  end
end

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
govuk_app_config-9.15.2 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.15.1 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.15.0 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.14.6 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.14.5 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.14.4 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.14.3 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.14.2 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.14.1 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.14.0 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.13.1 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.13.0 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.12.0 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.11.2 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.11.1 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.11.0 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.10.0 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.9.2 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.9.1 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.9.0 lib/govuk_app_config/govuk_proxy/static_proxy.rb