From fb4fee3bd2d955be90a2f863094029b195a77daa Mon Sep 17 00:00:00 2001 From: Marius Melzer Date: Sat, 18 Apr 2020 16:46:47 +0200 Subject: [PATCH] Document cowboy_router host/path matching order Explaining better how to write routes, coming from this misunderstanding: https://github.com/ninenines/cowboy/issues/1448 --- doc/src/guide/routing.asciidoc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/src/guide/routing.asciidoc b/doc/src/guide/routing.asciidoc index 9e2ef25b..082e322b 100644 --- a/doc/src/guide/routing.asciidoc +++ b/doc/src/guide/routing.asciidoc @@ -49,6 +49,11 @@ constraints. The match syntax is used to associate host names and paths with their respective handlers. +The handler is chosen by following only the first matching host and for +this host only the first matching path. Beware that this means: if two +hosts match but only the second includes a matching path, the request will +be denied. + The match syntax is the same for host and path with a few subtleties. Indeed, the segments separator is different, and the host is matched starting from the last segment going to the first. All examples will