pvcnt / mergeable

A better inbox for GitHub pull requests
https://pvcnt.github.io/mergeable/
MIT License
35 stars 6 forks source link

fix(server): manage refresh on page like`/settings` or `stars` #51

Closed davinkevin closed 3 months ago

davinkevin commented 3 months ago

Hello 👋

I discover a pretty common error to Single-page-application. When the app is loaded on page like /settings, if we do a refresh we get 404 from nginx.

The configuration should be redirect everything to /.

As a developer of a single page app, I've chosen Static Web Server, which is lighter than nginx, has less CVEs and provide the feature I described above with the following configuration:

[general]

host = "::"
port = 80
root = "/path/where/you/store/your/app"
log-level = "info"

page-fallback = "/path/where/you/store/your/app/index.html"
cache-control-headers = true
compression = true
security-headers = true
directory-listing = false
redirect-trailing-slash = true
compression-static = true
ignore-hidden-files = true

If you want a PR to introduce Static Web Server instead of nginx, let me know 😇

pvcnt commented 3 months ago

Hi! Indeed, it doesn't work. I'm not against moving to something more lightweight than nginx. I'm also considering right now having a Node server to have some API that will be needed for more advanced use cases and a better user experience (e.g., OAuth login), in which case that server may serve the static files as well (or not...).

davinkevin commented 3 months ago

Yeah, if backend is required, it makes total sense.

If not, right now there is simpler, smaller and something with less CVEs 😇.

It really depends when you plan to introduce the node backend 👍

pvcnt commented 3 months ago

Even though a backend will be required at some point, I'm not sure I am ready to introduce it right now. If that is not too much work for you, I would gladly accept a PR that solves this issue and uses a more lightweight Web server.

davinkevin commented 3 months ago

Perfect!

I should be able to do it during this week using my "learning day" time provided by my company.

davinkevin commented 3 months ago

@pvcnt Done ✅: https://github.com/pvcnt/mergeable/pull/55