I find this fragment takes great care of the situation. Views that need SSL will have them by redirecting from http to the https version of the url and vice versa.
Yes, on the https page, an outgoing link to a page other than https on your site will continue with https, but the user will be redirected to the http version.
(However, there is a question: it will not work if you send a message from http to https and vice versa)
source share