Websites/lib/middleware/dev_host_middleware.rb
Donovan Daniels 90c05547f6
Move dev host rewriting into middleware
This makes matching against routes later much more reliable and less complicated
2024-05-03 17:53:47 -05:00

15 lines
256 B
Ruby

class DevHostMiddleware
def initialize(app)
@app = app
end
def call(env)
request = Rack::Request.new(env)
domain = request.params["domain"]
env["HTTP_HOST"] = domain if Rails.env.development? && domain
@app.call(env)
end
end