You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have the following two files at the same level of Cargo.toml:
static/index.html
static/test/index.html
Then I wrote the following code:
use poem::{endpoint::EmbeddedFilesEndpoint, listener::TcpListener, Route, Server};
use rust_embed::RustEmbed;
#[derive(RustEmbed)]
#[folder = "static"]
pub struct Static;
#[tokio::main]
async fn main() -> Result<(), std::io::Error> {
if std::env::var_os("RUST_LOG").is_none() {
std::env::set_var("RUST_LOG", "poem=debug");
}
tracing_subscriber::fmt::init();
let app = Route::new().nest("/static", EmbeddedFilesEndpoint::<Static>::new());
Server::new(TcpListener::bind("0.0.0.0:3000"))
.run(app)
.await
}
When I visit http://127.0.0.1:3000/static, the program can get static/index.html correctly.
When I visit http://127.0.0.1:3000/static/test/index.html, the program can also get static/test/index.html correctly.
But when I visit http://127.0.0.1:3000/static/test and http://127.0.0.1:3000/static/test/, I get 404 errors. But they should be correctly redirected to static/test/index.html just like static/index.html.
I think this is a bug.
The text was updated successfully, but these errors were encountered:
I have the following two files at the same level of Cargo.toml:
Then I wrote the following code:
When I visit
http://127.0.0.1:3000/static
, the program can getstatic/index.html
correctly.When I visit
http://127.0.0.1:3000/static/test/index.html
, the program can also getstatic/test/index.html
correctly.But when I visit
http://127.0.0.1:3000/static/test
andhttp://127.0.0.1:3000/static/test/
, I get 404 errors. But they should be correctly redirected tostatic/test/index.html
just likestatic/index.html
.I think this is a bug.
The text was updated successfully, but these errors were encountered: