HSTS for Ruby with Sinatra: Copy-Paste Reference

If you run a Sinatra app over HTTPS, you should probably set HSTS. Not “maybe later.” Not “after the next sprint.” If your app is meant to be HTTPS-only, HSTS is one of the simplest ways to stop protocol downgrade attacks and cookie leakage caused by accidental HTTP visits. This guide is the practical version: what header to send, where to set it in Sinatra, how to avoid bricking subdomains, and how to roll it out without surprises. ...

November 12, 2026 · 6 min · headertest.com