aosasona / chimney

A minimal & fast static file server designed for minimal configuration
Apache License 2.0
6 stars 2 forks source link

bug: investigate possible regression with fallback path #31

Open aosasona opened 6 months ago

aosasona commented 6 months ago

Latest deployment of my website does not seem to be falling back to 404.html as expected

aosasona commented 6 months ago

https://github.com/aosasona/chimney/blob/b0dc025c1fae07289cdbf51f19ac1cbe90fe027d/src/server.rs#L281-L287

This may be the culprit, we should checking for the fallback path when we load the config, and also before we send a plain 404

aosasona commented 6 months ago

Also here: https://github.com/aosasona/chimney/blob/b0dc025c1fae07289cdbf51f19ac1cbe90fe027d/src/server.rs#L271-L276

We are checking for rewrites and redirects but again, nothing about the fallback (which I am guessing has to do with the logic in the function to get a valid path

aosasona commented 6 months ago

I take it back, we seem to be doing the necessary checks at first glance but I will have a look again properly tomorrow

https://github.com/aosasona/chimney/blob/b0dc025c1fae07289cdbf51f19ac1cbe90fe027d/src/server.rs#L176-L183

aosasona commented 6 months ago

Actually, this seems like it's happening specifically for /projects route

aosasona commented 6 months ago

Right! This is because the projects directory exists after building but it only contains images, so we are clearly not checking for the absence of that index.html and falling back somewhere. This is the file tree after building:

projects/ ├── bazooka.png ├── chimney.png ├── cleep.png ├── crossbar.png ├── dotenv.png ├── falcon.png ├── hitlist.png ├── jenzo.png ├── jsorm.png ├── migrant.png ├── mirror.png ├── neat-http.png ├── phlo.png ├── phprouter.png ├── plunk.png ├── quiksnip.png ├── reda.png ├── scrawny.png ├── sidekyk.png ├── stripr.png └── vanity.png