You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Transform a request host+URL (in the form of "host[:port]/request/path?param=value")
28
+
into another one if it is matched by regular expression `match`.
29
+
30
+
The rewrite target is specified by `replace`.
31
+
Use `$0` to represent the whole match in `match`.
32
+
use `$1` - `$9` to represent sub matches in `match`.
33
+
--rewrite-host-post <sep><match><sep><replace>
34
+
Similar to --rewrite-host, but executes after redirects has no match.
35
+
--rewrite-host-end <sep><match><sep><replace>
36
+
Similar to --rewrite-host-post, but skip rest process if matched.
37
+
26
38
--rewrite <separator><match><separator><replace>
27
39
Transform a request URL (in the form of "/request/path?param=value")
28
40
into another one if it is matched by regular expression `match`.
@@ -75,10 +87,10 @@ This means it is impossible to use legacy Go version to compile binaries for leg
75
87
-`--status-page` executed if status code matched, and stop processing.
76
88
- if client IP match `--ip-deny` or `--ip-deny-file`, return status 403, and stop processing
77
89
-`--status-page` executed if status code matched, and stop processing.
78
-
-`--rewrite` executed to transform the URL if matched.
90
+
-`--rewrite-host` and `--rewrite` executed to transform the URL if matched.
79
91
-`--redirect` executed if URL matched, and stop processing.
80
-
-`--rewrite-post` executed to transform the URL if matched.
81
-
-`--rewrite-end` executed to transform the URL if matched, and skip rest of `--rewrite-end`, `--redirect`, `--proxy`and `--return`.
92
+
-`--rewrite-host-post` and `--rewrite-post` executed to transform the URL if matched.
93
+
-`--rewrite-host-end`and `--rewrite-end`executed to transform the URL if matched, and skip rest processes like `--rewrite[-host]-end`, `--proxy``--return`, etc.
82
94
-`--proxy` executed if URL matched, and stop processing.
83
95
-`--header-add` and `--header-set` executed if URL matched, and stop processing.
84
96
-`--return` executed if URL matched, and stop processing.
err=options.AddFlagValues("ipdenyfiles", "--ip-deny-file", "", nil, "specify denied client IP from files, rests are allowed if no allow list")
29
29
serverError.CheckFatal(err)
30
30
31
+
err=options.AddFlagValues("rewritehosts", "--rewrite-host", "", nil, "add rule to replace request URL by host+request_URL, format <sep><match><sep><replace>")
32
+
serverError.CheckFatal(err)
33
+
34
+
err=options.AddFlagValues("rewritehostspost", "--rewrite-host-post", "", nil, "add rule to replace request URL by host+request_URL after redirects, format <sep><match><sep><replace>")
35
+
serverError.CheckFatal(err)
36
+
37
+
err=options.AddFlagValues("rewritehostsend", "--rewrite-host-end", "", nil, "add rule to replace request URL by host+request_URL, and skip further actions, format <sep><match><sep><replace>")
38
+
serverError.CheckFatal(err)
39
+
31
40
err=options.AddFlagValues("rewrites", "--rewrite", "", nil, "add rule to replace request URL, format <sep><match><sep><replace>")
0 commit comments