zer0tonin / Mikochi

A minimalist file-manager with streaming capabilities
MIT License
224 stars 12 forks source link

Fix direct url navigation in production builds #2

Closed zer0tonin closed 7 months ago

zer0tonin commented 7 months ago

Using the production build, you cannot directly access subfolders and are greeted by a 404 error instead.

Steps to reproduce

  1. Run the production container (make run)
  2. Access the mikochi UI and create a subfolder (let's name it /sub)
  3. Try to access it directly with the url http://localhost:8080/sub

Possible cause

In the production builds, the routes that are outside of /api are directed to serve static files: https://github.com/zer0tonin/Mikochi/blob/main/backend/main.go#L38 This code doesn't redirect random urls to our index.html which handles the frontend routing.