aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNorberto Lopes <nlopes.ml@gmail.com>2023-08-07 11:02:33 +0000
committerNorberto Lopes <nlopes.ml@gmail.com>2023-08-07 11:02:33 +0000
commit9a24cfdd271b6172fe405133d8dd75acc53854ad (patch)
tree154e8a85b8343cd267414cef14b9fa1399fdf98e
parentAdd pretty urls (diff)
downloadminiserve-9a24cfdd271b6172fe405133d8dd75acc53854ad.tar.gz
miniserve-9a24cfdd271b6172fe405133d8dd75acc53854ad.zip
Adjust from feedback
- remove info logging - add comment to clarify logic
-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