plugin/header: Add support for query modification (#5548) (#5556)

This commit is contained in:
Christoph Heer
2022-08-12 13:46:06 +02:00
committed by GitHub
parent c7fe4a0c4d
commit 5c1447e0b0
6 changed files with 176 additions and 51 deletions

View File

@@ -2,22 +2,24 @@
## Name
*header* - modifies the header for responses.
*header* - modifies the header for queries and responses.
## Description
*header* ensures that the flags are in the desired state for responses. The modifications are made transparently for
the client.
*header* ensures that the flags are in the desired state for queries and responses.
The modifications are made transparently for the client and subsequent plugins.
## Syntax
~~~
header {
ACTION FLAGS...
ACTION FLAGS...
[SELECTOR] ACTION FLAGS...
[SELECTOR] ACTION FLAGS...
}
~~~
* **SELECTOR** defines if the action should be applied on `query` or `response`. In future CoreDNS version the selector will be mandatory. For backwards compatibility the action will be applied on `response` if the selector is undefined.
* **ACTION** defines the state for DNS message header flags. Actions are evaluated in the order they are defined so last one has the
most precedence. Allowed values are:
* `set`
@@ -34,7 +36,7 @@ Make sure recursive available `ra` flag is set in all the responses:
~~~ corefile
. {
header {
set ra
response set ra
}
}
~~~
@@ -44,8 +46,18 @@ Make sure "recursion available" `ra` and "authoritative answer" `aa` flags are s
~~~ corefile
. {
header {
set ra aa
clear rd
response set ra aa
response clear rd
}
}
~~~
Make sure "recursion desired" `rd` is set for all subsequent plugins::
~~~ corefile
. {
header {
query set rd
}
}
~~~