# HTTP.jl router with constant path elements

**URL:** <https://discourse.julialang.org/t/http-jl-router-with-constant-path-elements/77692>\
**Category:** General Usage\
**Tags:** httpjl\
**Created:** [March 10, 2022, 3:27pm UTC](https://discourse.julialang.org/t/http-jl-router-with-constant-path-elements/77692 "2022-03-10T15:27:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![xor0110](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xor0110/32/7926_2.png) [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Post date:** [March 10, 2022, 3:27pm UTC](https://discourse.julialang.org/t/http-jl-router-with-constant-path-elements/77692/1 "2022-03-10T15:27:30Z")

</div>

I want to register urls of the format:  
“base/\*”  
“base/\*/\*”  
“base/\*/\*/constant1”  
“base/\*/\*/constant1/\*”  
“base/\*/\*/constant2”  
“base/\*/\*/constant2/\*”

This seemed to work for a while, but after adding a few more routes it seems the routing is getting mixed-up somehow… What exactly does “\*” represent? Is it not strictly a non-/ part of a path?

---

<div class="post-metadata">

**Author:** ![xor0110](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xor0110/32/7926_2.png) [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Post date:** [March 10, 2022, 4:24pm UTC](https://discourse.julialang.org/t/http-jl-router-with-constant-path-elements/77692/2 "2022-03-10T16:24:34Z")

</div>

My main problem was actually a bug on my side, but I did notice that a path like “a/b/c” was matching the route “\*/\*”. Is this a bug or a feature? Is the idea that we can match a route with “two or more” elements?

---

<div class="post-metadata">

**Author:** ![herman435](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/herman435/32/222787_2.png) [@herman435](https://discourse.julialang.org/u/herman435)\
**Post date:** [August 15, 2026, 6:55pm UTC](https://discourse.julialang.org/t/http-jl-router-with-constant-path-elements/77692/3 "2026-08-15T18:55:26Z")

</div>

Yeah, \* in HTTP.jl is basically matching a single path segment, not an arbitrary chunk containing /. The problem is likely the overlapping routes, the more generic \* routes can end up matching before the ones with constant1 or constant2. I’d make the constant routes more specific and register them before the generic catch-all routes. That usually avoids the routing getting ambiguous as the number of routes grows.
