Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 11, 09:45 UTC
forwardauth: error on duplicate uri subdirective (#7814)
Rhul committed
Jun 11, 2026 at 09:01 UTC
0f7f8e9cf627ac163d6d2e7c69ed3d628f266a93
2 files changed
+17
-1
caddytest/integration/caddyfile_adapt/forward_auth_duplicate_uri.caddyfiletest
new
+12
@@ -0,0 +1,12 @@
1
+localhost:9080 {
2
+ forward_auth :9091 {
3
+ uri /first
4
+ uri /second
5
+ copy_headers Remote-User
6
+ }
7
+
8
+ respond "ok" 200
9
+}
10
+
11
+----------
12
+parsing caddyfile tokens for 'forward_auth': cannot re-declare uri: /second
modules/caddyhttp/reverseproxy/forwardauth/caddyfile.go
+5
-1
@@ -129,7 +129,11 @@ func parseCaddyfile(h httpcaddyfile.Helper) ([]httpcaddyfile.ConfigValue, error)
129
if !dispenser.NextArg() {
130
return nil, dispenser.ArgErr()
131
}
132
- rpHandler.Rewrite.URI = dispenser.Val()
132
+ uri := dispenser.Val()
133
+ if rpHandler.Rewrite.URI != "" {
134
+ return nil, dispenser.Errf("cannot re-declare uri: %s", uri)
135
+ }
136
+ rpHandler.Rewrite.URI = uri
137
dispenser.DeleteN(2)
138
139
case "copy_headers":