Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Documentation errors #286

saleyn opened this Issue · 6 comments

2 participants


It seems that the documentation rules for static routes are not correct. Here the use of ' * ' is misleading:

The problem is that ' * ' does not have any special meaning and doesn't not really mean to match to "any" subpath (i.e. "/x/path", "/y/path"), but it means to bind a variable ' * ' with the first element in the path. It is no different than giving any other name to that variable:

3> cowboy_dispatcher:match([{'_', [{['*', <<"a">>], my, []}]}], <<"">>, <<"/*/a">>).
4> cowboy_dispatcher:match([{'_', [{[x, <<"a">>], my, []}]}], <<"">>, <<"/*/a">>).

Finally, the documentation of ' * ' has no significance as ' * ' is not implemented in the dispatching code to serve any useful purpose:

The dispatch rule is only going to match if the given path is passed as ' * ' instead of a binary, which I believe never happens:

5> cowboy_dispatcher:match([{'_', [{'*', my, []}]}], <<"">>, <<"/a/b/c/d">>).

6> cowboy_dispatcher:match([{'_', [{[<<"a">>,'*'], my, []}]}], <<"">>, <<"/a/b/c/d">>).

7> cowboy_dispatcher:match([{'_', [{'*', my, []}]}], <<"">>, '*').

Yeah there's two issues there:

  • '*' should be '_'
  • The path '*' is now <<"*">> so the clause is wrong or not needed anymore

Thanks for spotting this!



@saleyn saleyn closed this

Please don't close it's not fixed yet. :)

@essen essen reopened this



That should be fixed in 9942beb. Thanks!

@essen essen closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.