gotham-rs / gotham

A flexible web framework that promotes stability, safety, security and speed.
https://gotham.rs
Other
2.23k stars 125 forks source link

Cross-segment regex route matching #613

Open mzr opened 1 year ago

mzr commented 1 year ago

Hi,

I know I can have a route defined with regex like /abcd/:id:.*, however this doesn't match /abcd/a/b. Is there a way to do this in Gotham, where .* is not constrained to a single segment? I can always have a glob matcher /abcd/* and parse rest of the uri myself, but was wondering if Gotham supports something like this and I have missed it. Ideally I'd like something like: ^/abcd/(.+)\.cgi/*

I'm pretty much extracting a path and passing it to a fCGI script down the line.

Thanks!

mzr commented 1 year ago

In nginx for example I can have a location: location ~ '/abcd/(?<multiple_segments>.+\.cgi)(?<rest_of_the_uri>.*)

https://nginx.org/en/docs/http/ngx_http_core_module.html#location

msrd0 commented 1 year ago

I don't think regex glob matching is currently implemented