mirror of
https://github.com/coredns/coredns.git
synced 2025-11-02 02:03:13 -05:00
plugin/forward: Enable multiple forward declarations (#5127)
* enable multiple declarations of forward plugin Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
This commit is contained in:
@@ -19,8 +19,6 @@ is taken as a healthy upstream. The health check uses the same protocol as speci
|
||||
When *all* upstreams are down it assumes health checking as a mechanism has failed and will try to
|
||||
connect to a random upstream (which may or may not work).
|
||||
|
||||
This plugin can only be used once per Server Block.
|
||||
|
||||
## Syntax
|
||||
|
||||
In its most basic form, a simple forwarder uses this syntax:
|
||||
@@ -141,6 +139,40 @@ example.org {
|
||||
}
|
||||
~~~
|
||||
|
||||
Send all requests within `lab.example.local.` to `10.20.0.1`, all requests within `example.local.` (and not in
|
||||
`lab.example.local.`) to `10.0.0.1`, all others requests to the servers defined in `/etc/resolv.conf`, and
|
||||
caches results. Note that a CoreDNS server configured with multiple _forward_ plugins in a server block will evaluate those
|
||||
forward plugins in the order they are listed when serving a request. Therefore, subdomains should be
|
||||
placed before parent domains otherwise subdomain requests will be forwarded to the parent domain's upstream.
|
||||
Accordingly, in this example `lab.example.local` is before `example.local`, and `example.local` is before `.`.
|
||||
|
||||
~~~ corefile
|
||||
. {
|
||||
cache
|
||||
forward lab.example.local 10.20.0.1
|
||||
forward example.local 10.0.0.1
|
||||
forward . /etc/resolv.conf
|
||||
}
|
||||
~~~
|
||||
|
||||
The example above is almost equivalent to the following example, except that example below defines three separate plugin
|
||||
chains (and thus 3 separate instances of _cache_).
|
||||
|
||||
~~~ corefile
|
||||
lab.example.local {
|
||||
cache
|
||||
forward . 10.20.0.1
|
||||
}
|
||||
example.local {
|
||||
cache
|
||||
forward . 10.0.0.1
|
||||
}
|
||||
. {
|
||||
cache
|
||||
forward . /etc/resolv.conf
|
||||
}
|
||||
~~~
|
||||
|
||||
Load balance all requests between three resolvers, one of which has a IPv6 address.
|
||||
|
||||
~~~ corefile
|
||||
|
||||
Reference in New Issue
Block a user