app: enable host authorization in production

This commit is contained in:
Sergei Poljanski 2026-07-02 18:40:20 +04:00
commit 9e85082758
Signed by: asxpi
GPG key ID: 4F8851660FA4121B

View file

@ -43,7 +43,11 @@ class AsxpioWeb < Sinatra::Base
set :root, $root set :root, $root
set :erb, layout: :layout, escape_html: true set :erb, layout: :layout, escape_html: true
set :show_exceptions, $env == 'development' set :show_exceptions, $env == 'development'
set :host_authorization, { permitted_hosts: [] } # Traefik only routes our hostnames anyway; this is defense in depth.
# 127.0.0.1 is the Docker HEALTHCHECK. Empty list (= check disabled)
# outside production so dev and rack-test hosts keep working.
set :host_authorization,
{ permitted_hosts: $env == 'production' ? ['asxp.io', 'www.asxp.io', '127.0.0.1'] : [] }
end end
use Rack::Session::Cookie, use Rack::Session::Cookie,