mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 19:25:56 +03:00
[GH-ISSUE #3346] Add ability to inject custom headers into a DoH / DoQ query #1173
Labels
No labels
blocked
breaking-change
bug
bug:critical
bug:tests
cleanup
compliance
compliance
compliance
crate:all
crate:client
crate:native-tls
crate:proto
crate:recursor
crate:resolver
crate:resolver
crate:rustls
crate:server
crate:util
dependencies
docs
duplicate
easy
easy
enhance
enhance
enhance
feature:dns-over-https
feature:dns-over-quic
feature:dns-over-tls
feature:dnsssec
feature:global_lb
feature:mdns
feature:tsig
features:edns
has workaround
ops
perf
platform:WASM
platform:android
platform:fuchsia
platform:linux
platform:macos
platform:windows
pull-request
question
test
tools
tools
trust
unclear
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hickory-dns#1173
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @lpraneis on GitHub (Nov 10, 2025).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/3346
Is your feature request related to a problem? Please describe.
The DoH / DoQ client doesn't have a way to add custom headers to the request.
Describe the solution you'd like
Similar to the
query_pathparameter ( https://github.com/hickory-dns/hickory-dns/pull/2226 ), I would like to implement a new field in the name server configuration that allows the user to provide either a static header or an async callback to get a header dynamically. This header will be used when building a request for DoH or DoQ.Describe alternatives you've considered
An alternative is to implement a custom
ConnectionProviderbut this requires re-implementing DNS pipelining for H2, etc. and seems overkill for a simple feature.Additional context
I'm happy to do this work, I'm mostly just interested to see if there is any appetite to include this.
@djc commented on GitHub (Nov 10, 2025):
Not sure I'd want to specifically enable this in the resolver config types. It does feel like a custom ConnectionProvider is the right way forward, maybe we can modularize the API for H2 to facilitate header injection without a bunch of duplication?
What's the goal here? Why do you want to inject headers?
@lpraneis commented on GitHub (Nov 10, 2025):
I have a use-case that involves a DoH server that requires authentication and expects that authentication to be provided via a header. Currently, this is implemented using a custom ConnectionProvider with a custom HTTP client but this is a lot of code to upkeep for what is essentially a less optimized solution than what is provided by hickory.
This could work. I will look into if it's feasible to create a minimal custom
ConnectionProviderthat uses the preexistingDnsExchangeandHttpsClientConnect. The config could then be added to theHttpsClientConnecttype for DoH andQuicClientConnectfor DoQ@lpraneis commented on GitHub (Nov 10, 2025):
yeah that works and is pretty straightforward. It does require re-implementing some generic types like
GenericConnectionsince the inner tuple data isn't pub, but idk if we want to expose those and it's easy enough to do.Would you be open to a configuration option on the
HttpsClientConnect?I'm imagining something like an
Option<Arc<dyn GetHeaders>>in theTlsConfigstruct that currently holds the other HTTP-config likehttp_endpoint@djc commented on GitHub (Nov 10, 2025):
Please PR a draft so I can have a look.