ServeDir works in Development but not in Production, Rust Axum

279 views Asked by At

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

Serving static files

1

There are 1 answers

0
Eloff On

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.