Force HTTPS
The force-https middleware can redirect all requests to use the HTTPS protocol.
If this middleware is applied to a Router, it will only enforce protocol redirection when a route is matched. If a page does not exist, no redirection will occur.
However, a more common requirement is to automatically redirect any request, even when the route fails to match and returns a 404 error. In such cases, the middleware can be added to the Service. Middleware added to the Service will always execute, regardless of whether the request is successfully matched by a route.
Example Code