Hwaro::Services::DevCorsHandler
Inherits HTTP::Handler / Reference / Object
Emits Access-Control-Allow-Origin: * on every dev-server response so
a site loaded via one local hostname can still fetch() resources
served under another — the canonical example being localhost:3000
in the address bar while {{ base_url }} was baked as
http://127.0.0.1:3000 (the default bind). Same-origin policy treats
those as different origins and would otherwise block the fetch.
Dev-only: the built output is untouched. Matches what other SSG dev servers do (Zola, Hugo).
Constructors
new(allowed_hosts : Set(String) = Set {"localhost", "127.0.0.1", "::1"})
Allowed CORS origin hosts: loopback literals plus the host the server was bound to (when it's concrete, not a 0.0.0.0/:: wildcard).
Instance methods
call(context)
Source