Ways to enable a clean restart on Windows

I am using Caddy in production - albeit a very low volume company site, but still production.

To counter issues with php fast-cgi I restart caddy periodically with a script . The only way to do this on windows without a lot of fooling around is to call taskkill -f

The issue here is that it does not allow caddy to shutdown gracefully and forces shutdown which may (in extreme cases) cause corruption of the request, and it does prevent the shutdown directive from being run.

Neither of these are an issue for me at the moment as my production site is not heavy traffic and I don’t currently run any shutdown directives. However it would be an issue for others so I got to thinking about alternative options.

Would it be possible or desireable to have a way of communicating with caddy via a webbrowser to request a restart? Perhaps use of a specific caddy:// protocol. Perhaps a visit to

caddy://restart 

would make caddy do a controlled restart.

I appreciate there is a security concern with remote restart but perhaps it could be limited to requests recieved from localhost.

If this is an idea that has legs It could be developed further .

Caddy’s going to get an API that will allow you to issue restarts via authenticated POST requests. I think that will probably cover what you are looking for?

Yes that would fit perfectly.