From 9a24cfdd271b6172fe405133d8dd75acc53854ad Mon Sep 17 00:00:00 2001 From: Norberto Lopes Date: Mon, 7 Aug 2023 12:02:33 +0100 Subject: Adjust from feedback - remove info logging - add comment to clarify logic --- src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 43878db..78e8472 100644 --- a/src/main.rs +++ b/src/main.rs @@ -318,8 +318,13 @@ fn configure_app(app: &mut web::ServiceConfig, conf: &MiniserveConfig) { } } + // Handle --pretty-urls options. + // + // We rewrite the request to append ".html" to the path and serve the file. If the + // path ends with a `/`, we remove it before appending ".html". + // + // This is done to allow for pretty URLs, e.g. "/about" instead of "/about.html". if conf.pretty_urls { - log::info!("Pretty URLs enabled."); files = files.default_handler(fn_service(|req: ServiceRequest| async { let (req, _) = req.into_parts(); let conf = req -- cgit v1.2.3