Matching on leading double slash

UPDATE: I’m not pursuing this any further, but if anyone has ideas I’d be interested in hearing how this is possible.

I have a use case where I need to match on a route that could be one of the following:


I’ve tried several different approaches that I would consider normal, but in looking at the code, I’m seeing that kong interprets routes that begin with the double slash as an empty regex.

Is this possible?

Things I’ve tried that did not work:

  • Adding one line for each route as it shows above
  • //?this-endpoint
  • //?this-endpoint

Paths used to be normalized so many slashes would be collapsed to one, that’s the why of this guard.

That said, nowadays Kong does not use $uri but $request_uri and keeps the double slashes. You can get creative with regexes to allow those. For example, /(/)?this-endpoint would work.