We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mount.mount("/", staticfile::Static::new(Path::new("../assets/index.html")));
I hope it serve the static file when the Path is file. (fn Path::is_file(&self) -> bool) / => index.html /404 => index.html
more : https://github.com/rackt/react-router/blob/latest/docs/guides/basics/Histories.md#configuring-your-server
The text was updated successfully, but these errors were encountered:
I'm wondering how to do this as well.
Sorry, something went wrong.
@Alsmile This may interest you.
I glanced at the source code of staticfile and used the following, in my opinion, hacky approach; which was adapted from https://github.com/iron/router/blob/master/examples/custom_404.rs
staticfile
This works for my js app that uses html5 (pop/push)state:
struct Custom404 { staticfile: Static } impl AfterMiddleware for Custom404 { fn catch(&self, req: &mut Request, err: IronError) -> IronResult<Response> { // TODO: so hacky. need better alternative req.url.path = vec!["index.html".to_string()]; return self.staticfile.handle(req); // return Ok(Response::with((status::NotFound, "404 Not Found"))); } } // ... let custom_404 = Custom404 { staticfile: Static::new(app_path) }; log_chain.link_after(custom_404);
No branches or pull requests
mount.mount("/", staticfile::Static::new(Path::new("../assets/index.html")));
I hope it serve the static file when the Path is file. (fn Path::is_file(&self) -> bool)
/ => index.html
/404 => index.html
more :
https://github.com/rackt/react-router/blob/latest/docs/guides/basics/Histories.md#configuring-your-server
The text was updated successfully, but these errors were encountered: