aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main.rs7
1 files changed, 6 insertions, 1 deletions
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