helmet
Version, currently 0.2.35 versions
github.com/EvanHahn/crystal-helmet
Help secure web apps with various HTTP headers
29 stars
1 dependent
License: MIT
Installation
# Add this to your shard.yml
dependencies:
helmet:
github: EvanHahn/crystal-helmet
version: ~> 0.2.3Then run:
shards installshard.yml
- Crystal
- no constraint declared
- License
- MIT
- Author
- Evan Hahn
Dependencies
This version declares no dependencies.
README
Helmet
Helmet helps you secure your Crystal web apps by setting various HTTP headers. It's not a silver bullet, but it can help!
This is a port of the Node.js version of Helmet.
Installation
Add this to your application's shard.yml:
dependencies:
helmet:
github: EvanHahn/crystal-helmet
Usage
require "http/server"
require "helmet"
server = HTTP::Server.new(
[
Helmet::DNSPrefetchControllerHandler.new,
Helmet::FrameGuardHandler.new,
Helmet::InternetExplorerNoOpenHandler.new,
Helmet::NoSniffHandler.new,
Helmet::StrictTransportSecurityHandler.new(7.day),
Helmet::XSSFilterHandler.new,
]) do |context|
context.response.content_type = "text/plain"
context.response.print "Hello world!"
end
address = server.bind_tcp(8080)
server.listen
Helmet is really just a collection of smaller handlers that set HTTP headers. See them listed in the example above and in the documentation.
Contributing
- Fork it (https://github.com/EvanHahn/crystal-helmet/fork)
- Create your branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add XYZ') - Push to the branch (
git push origin my-new-feature) - Create a new pull request
Contributors
- Evan Hahn - creator, maintainer
- Du Ba Thach - #3
- Serdar Doğruyol - #9
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.2.3- Tagged
- Feb 16, 2026
- Commit
8ed4d9663e38- Indexed
- yes
Dependents
Repository
github.com/EvanHahn/crystal-helmet
Metadata
- Created
- Aug 12, 2026
- Updated
- Oct 4, 2026
- Synced
- Oct 4, 2026
- Versions
- 5