Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ServeDir works in Development but not in Production, Rust Axum

Tags:

rust

rust-axum

I'm using the latest version of tower-http (0.4.4) and following the same approach as in the main example

Router::new().nest_service("/assets", ServeDir::new("assets"));

Everything runs smoothly in development, but I don't understand why when I deploy it to Debian Linux, the static file URLs result in a 404 error.

like image 552
Fuji Avatar asked Oct 19 '25 19:10

Fuji


1 Answers

Did you also deploy the /assets directory to production in the same directory as the Rust binary? It still needs the files available to server them, they aren't compiled into your binary.

like image 74
Eloff Avatar answered Oct 22 '25 14:10

Eloff