How force goBack() and goHome() to https

I am deploying my app with ssl certificate. I faced an error since the load balancer force https. the problem is that whenever $this->redirect(…) is called the url is changed to http instead of https and the browser shows “This site can’t be reached”. I want to force all redirect actions to set the url to https.

I changed baseUrl for the url manager to [] to solve this problem. now it appears only on user loggin and logout. where goHome() and goBack() actions are used. How can I force https?

Can you verify that $_SERVER['HTTPS'] is on or 1? If not, you need to check if there’s a problem with web server configuration.