Sha256: e071a88a26d1a9404dcfe8a90410f229e77cf54a5c98a2c7ab02c049c80363f7

Contents?: true

Size: 564 Bytes

Versions: 56

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

56 entries across 56 versions & 1 rubygems

Version Path
govuk_app_config-9.9.0 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.8.2 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.8.1 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.8.0 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.7.0 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.6.0 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.5.0 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.4.0 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.3.0 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.2.0 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.1.0 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.0.4 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.0.3 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.0.2 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.0.1 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-9.0.0 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-8.1.1 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-8.1.0 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-8.0.2 lib/govuk_app_config/govuk_proxy/static_proxy.rb
govuk_app_config-8.0.1 lib/govuk_app_config/govuk_proxy/static_proxy.rb