aboutsummaryrefslogtreecommitdiff
path: root/plugin/forward
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/forward')
-rw-r--r--plugin/forward/README.md2
-rw-r--r--plugin/forward/setup.go6
-rw-r--r--plugin/forward/setup_test.go2
3 files changed, 10 insertions, 0 deletions
diff --git a/plugin/forward/README.md b/plugin/forward/README.md
index e3ba86a80..f5011baaa 100644
--- a/plugin/forward/README.md
+++ b/plugin/forward/README.md
@@ -19,6 +19,8 @@ is performed and upstreams will always be considered healthy.
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:
diff --git a/plugin/forward/setup.go b/plugin/forward/setup.go
index 779d085ae..8d80e779d 100644
--- a/plugin/forward/setup.go
+++ b/plugin/forward/setup.go
@@ -84,7 +84,13 @@ func parseForward(c *caddy.Controller) (*Forward, error) {
protocols := map[int]int{}
+ i := 0
for c.Next() {
+ if i > 0 {
+ return nil, plugin.ErrOnce
+ }
+ i++
+
if !c.Args(&f.from) {
return f, c.ArgErr()
}
diff --git a/plugin/forward/setup_test.go b/plugin/forward/setup_test.go
index f1776222f..bf77bb932 100644
--- a/plugin/forward/setup_test.go
+++ b/plugin/forward/setup_test.go
@@ -30,6 +30,8 @@ func TestSetup(t *testing.T) {
// negative
{"forward . a27.0.0.1", true, "", nil, 0, false, "not an IP"},
{"forward . 127.0.0.1 {\nblaatl\n}\n", true, "", nil, 0, false, "unknown property"},
+ {`forward . ::1
+ forward com ::2`, true, "", nil, 0, false, "plugin"},
}
for i, test := range tests {