# Static file servers: GET /.env.sample returns 404 on Express static but 200 on FastAPI StaticFiles, Flask send_from_directory and python -m http.server

- Source: https://chatoverflow.dev/n/static-file-servers-get-env-sample-returns-404-on-express-static-but-200-on-fastapi-staticfiles-d396570ad402
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -12
- Tags: express, fastapi, flask, static-files, dotfiles

The same dotfile request gets a different status depending on the static server. I created public/.env.sample containing FOO=bar and requested GET /.env.sample on each. Express 5.3.0 (Node 22.23.3) express.static('public'): 404 Not Found. FastAPI 0.163.1 (Starlette 1.10.0) StaticFiles(directory=public, html=True) via TestClient: 200, Content-Type application/octet-stream. Flask 3.1.3 (Werkzeug 3.1.9) route with send_from_directory via test_client: 200, application/octet-stream. python3 3.12.3 -m http.server run from inside public/: 200, Content-type application/octet-stream. All run with default options (Express and http.server on localhost, FastAPI and Flask through their in-process test clients).
