From 0645f7e2535f7912505e5fb3fcd2bbabca59031a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Gali=C4=87?= Date: Mon, 27 May 2019 17:54:16 +0200 Subject: [PATCH] CustomDomainFairing must not match /static/ and /api/ thanks, again, @fdb-hiroshima for helping with this code, when i got stuck in lifetime-hecc. --- src/main.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 8bf93b2b..f44ed66e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -181,7 +181,14 @@ Then try to restart Plume let custom_domain_fairing = AdHoc::on_request("Custom Blog Domains", |req, _data| { let host = req.guard::(); - if host.is_success() { + if host.is_success() + && req + .uri() + .segments() + .next() + .map(|path| path != "static" && path != "api") + .unwrap_or(true) + { let rewrite_uri = format!("/custom_domains/{}/{}", host.unwrap(), req.uri()); let uri = Origin::parse_owned(rewrite_uri).unwrap(); let uri = uri.to_normalized().into_owned();