class Helmet::DNSPrefetchControllerHandler
- Helmet::DNSPrefetchControllerHandler
- Reference
- Object
Overview
Some browsers optimistically prefetch DNS records for performance, which can have security implications. Read more about it on MDN and on Chromium's docs.
This handler sets the X-DNS-Prefetch-Control
to control browsers' DNS
prefetching behavior.
Disable DNS prefetching
You can disable DNS prefetching:
server = HTTP::Server.new("0.0.0.0", 8080, [
Helmet::DNSPrefetchControllerHandler.new(allow: false),
# ...
])
You can also leave out the allow
argument if you're doing this—false
is
the default:
server = HTTP::Server.new("0.0.0.0", 8080, [
Helmet::DNSPrefetchControllerHandler.new,
# ...
])
Enable DNS prefetching
server = HTTP::Server.new("0.0.0.0", 8080, [
Helmet::DNSPrefetchControllerHandler.new(allow: true),
# ...
])
Included Modules
- HTTP::Handler