Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reevaluate "_redirections" when file changes #127

Open
patrickdappollonio opened this issue Oct 9, 2024 · 0 comments
Open

Reevaluate "_redirections" when file changes #127

patrickdappollonio opened this issue Oct 9, 2024 · 0 comments

Comments

@patrickdappollonio
Copy link
Owner

patrickdappollonio commented Oct 9, 2024

Currently, when the server starts, the _redirections file gets loaded and the rules parsed.

If, during the time http-server has been running the _redirections file changes, those changes are not reflected as rule changes in the redirection system unless you restart http-server like, an index.html file served from the directory would normally change and its changes picked up.

We should be able to detect changes to the _redirections file or, alternatively, a way to let http-server know that file changed.

While I would prefer to detect changes to the file using a file watcher, I know finding a cross-platform solution is a bit challenging. We do have binaries for darwin, linux and windows (in ARM and x86_64 flavours) so we might just have to support those.

The other option described is to support a signal, a la Nginx or other servers where, if you send, say SIGUSR1 then you reload the _redirections file.

While in the past I've been against using watchers for configuration (I would prefer in those cases to get a fresh start), _redirections seems to warrant it more than others.

The caveat here is that if we detect changes on the file, and the file changes, and bad rules are configured, we should continue using the old rules but warn in the terminal that the rules file is invalid and we would continue to use the old rules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant