Skip to content

Commit b853835

Browse files
committed
Prioritize tenant host lookup in middleware
1 parent dd21e23 commit b853835

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/tenant/middleware.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ def call(env)
1111
request = ActionDispatch::Request.new(env)
1212
if request.path == "/up"
1313
@app.call(env)
14-
elsif PublicSuffix.parse(request.host).domain == ENV["APP_DOMAIN"]
15-
@app.call(env)
1614
elsif tenant = Tenant.find_by(host: request.host)
1715
Tenant.switch(tenant) { @app.call(env) }
16+
elsif PublicSuffix.parse(request.host).domain == ENV["APP_DOMAIN"]
17+
@app.call(env)
1818
else
1919
[ 404, {}, [ "Not Found" ] ]
2020
end

0 commit comments

Comments
 (0)