croservices / cro

Development tools for building services and distributed systems in Raku using the Cro libraries.
https://cro.services/
Artistic License 2.0
88 stars 35 forks source link

Common ReWrite request #159

Open finanalyst opened 1 year ago

finanalyst commented 1 year ago

A common rewrite is to add .html to routes on a website. Eg. routines/say is mapped to the web page routines/say.html and types/IO#say is mapped to types/IO.html#say

Currently :indexes adds a named file when there is a zero route.

Possibly :extension<html> might add .html if the route does map to an existing file.

finanalyst commented 1 year ago

Further to the above, Possibly make this more generic using :try-files. Apache uses a ReWrite conditional/rule. The conditional checks that the route is not a directory or existing file, then carries out a Regex based rewrite.

NGINX and Caddy use try-files. If a route does not match an existing file, then alternatives are tried.