How to redirect requests from HTTP to HTTPS

How can I find a way to redirect requests from http://:9944/path/... to https://:9944/path/... ?
If redirection is not possible then respond with an error and message to use https://:9944/ ?

The initial problem is that user has updated several links to use HTTPS for existing protocols, however if he runs (e.g. to debug) a protocol from within the desktop client, it will still open the result in the browser using the default HTTP (port 9944). Is there a way to have the client also use HTTPS?