Skip to content

Commit 9bbbad4

Browse files
committed
doc: router: options
- Add failOnDuplicateRoutes - fix #3741
1 parent fcff227 commit 9bbbad4

File tree

5 files changed

+86
-58
lines changed

5 files changed

+86
-58
lines changed

docs/asciidoc/handlers/access-log.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,5 @@ Extra request or response headers can be appended at the end using the available
5656
[TIP]
5757
====
5858
If you run behind a reverse proxy that has been configured to send the X-Forwarded-* header,
59-
please consider to use <<router-options-trust-proxy, trust proxy>> option.
59+
please consider to use <<router-options-routing, trust proxy>> option.
6060
====

docs/asciidoc/handlers/ssl.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import io.jooby.handler.SSHandler
3838
<1> Install SSLHandler
3939

4040
The SSL Handler recreates the HTTPs URL version using the `Host` header, if you are behind a proxy
41-
you will need to use the `X-Forwarded-Host` header. To do that set the <<router-options-trust-proxy, trust proxy>> option.
41+
you will need to use the `X-Forwarded-Host` header. To do that set the <<router-options-routing, trust proxy>> option.
4242

4343
Optionally, you can specify the host to use:
4444

@@ -79,5 +79,5 @@ For more information about SSL, please check the <<server-https-support, configu
7979
[TIP]
8080
====
8181
If you run behind a reverse proxy that has been configured to send the X-Forwarded-* header,
82-
please consider adding the <<router-options-trust-proxy, trust proxy>> to your pipeline.
82+
please consider adding the <<router-options-routing, trust proxy>> to your pipeline.
8383
====

docs/asciidoc/router-options.adoc

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
==== Routing
2+
3+
The javadoc:Router[setRouterOptions, io.jooby.RouterOptions] control routing options.
4+
5+
.Usage
6+
[source, java, role = "primary"]
7+
----
8+
import io.jooby.Jooby;
9+
...
10+
{
11+
12+
setRouterOptions(new RouterOptions()
13+
.setIgnoreCase(true)
14+
.setFailOnDuplicateRoutes(true)
15+
.setIgnoreTrailingSlash(true)
16+
.setNormalizeSlash(true)
17+
.setResetHeadersOnError(false)
18+
.setTrustProxy(true)
19+
);
20+
}
21+
----
22+
23+
.Kotlin
24+
[source, kotlin, role = "secondary"]
25+
----
26+
import io.jooby.Jooby
27+
...
28+
{
29+
routerOptions = RouterOptions().apply {
30+
ignoreCase = true
31+
ignoreTrailingSlash = true
32+
failOnDuplicateRoutes = true
33+
normalizeSlash = true
34+
resetHeadersOnError = false
35+
trustProxy = true
36+
}
37+
}
38+
----
39+
40+
[cols="1,1,1,1"]
41+
|===
42+
| Option | Value | Default Value| Description
43+
44+
|ignoreCase
45+
|boolean
46+
|false
47+
|Indicates whenever routing algorithm does case-sensitive matching on an incoming request path.
48+
49+
|ignoreTrailingSlash
50+
|boolean
51+
|false
52+
|Indicates whenever a trailing slash is ignored on an incoming request path.
53+
54+
|failOnDuplicateRoutes
55+
|boolean
56+
|false
57+
|Indicates whenever a trailing slash is ignored on an incoming request path.
58+
59+
|normalizeSlash
60+
|boolean
61+
|false
62+
|Normalize an incoming request path by removing multiple slash sequences.
63+
64+
|resetHeadersOnError
65+
|boolean
66+
|true
67+
|Indicates whenever response headers are clear/reset in case of exception.
68+
69+
|trustProxy
70+
|boolean
71+
|false
72+
|When true handles X-Forwarded-* headers by updating the values on the current context to match what was sent in the header(s).
73+
74+
|===
75+
76+
[IMPORTANT]
77+
====
78+
trustProxy: This should only be installed behind a reverse proxy that has been configured to send the
79+
`X-Forwarded-*` header, otherwise a remote user can spoof their address by sending a header with
80+
bogus values.
81+
====

docs/asciidoc/router-trust-proxy.adoc

Lines changed: 0 additions & 53 deletions
This file was deleted.

docs/asciidoc/routing.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,6 +1414,6 @@ might not work as you expected. It is recommend to use just the `logback.xml` or
14141414

14151415
=== Options
14161416

1417-
include::router-hidden-method.adoc[]
1417+
include::router-options.adoc[]
14181418

1419-
include::router-trust-proxy.adoc[]
1419+
include::router-hidden-method.adoc[]

0 commit comments

Comments
 (0)