3 ms·
From the proposal: "There is one last, special wildcard: {$} matches only the end of the URL, allowing writing a pattern that ends in slash but does not match
by FiloSottile 3y ago
From the proposal:
"There is one last, special wildcard: {$} matches only the end of the URL, allowing writing a pattern that ends in slash but does not match all extensions of that path. For example, the pattern /{$} matches the root page / but (unlike the pattern / today) does not match a request for /anythingelse."
- yankput 3y agoAhhh how did I miss that!! That is amazing. Goodbye gorilla mux.
- drdaeman 3y agoIdeally, this should be the default behavior, i.e. "/foo/" matching only "/foo/" and nothing else. And if one wants a prefix they should be able to explicitly spell it out like "/foo/{**}". But that’s not backwards-compatible, sadly, so this is going to remain a historical wart.