force redirect to app_protocol

This commit is contained in:
afornerot 2024-02-20 10:12:27 +01:00
parent 8e96aee7ab
commit 652d3365a1
3 changed files with 11 additions and 6 deletions

2
.env
View File

@ -1,7 +1,7 @@
# Symfony # Symfony
APP_ENV=PROD APP_ENV=PROD
APP_SECRET=changemeinenvlocal APP_SECRET=changemeinenvlocal
APP_PROTOCOL=http APP_PROTOCOL=https
#TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16 #TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
#TRUSTED_HOSTS='^(localhost|example\.com)$' #TRUSTED_HOSTS='^(localhost|example\.com)$'

View File

@ -11,7 +11,7 @@ class HomeController extends AbstractController
{ {
public function home() public function home()
{ {
return $this->redirectToRoute("app_scrum"); return $this->redirectToRoute("app_login");
} }
public function admin() public function admin()

View File

@ -200,10 +200,15 @@ class SecurityController extends AbstractController
// Redirection // Redirection
$redirect = $this->get('session')->get("_security.main.target_path"); $redirect = $this->get('session')->get("_security.main.target_path");
if($redirect) if($redirect) {
return $this->redirect($redirect); $redirect=str_replace("http://",$this->getParameter("appProtocol")."://",$redirect);
else
return $this->redirect($this->generateUrl('app_home')); }
else {
$redirect=$this->generateUrl('app_home');
$redirect=str_replace("http://",$this->getParameter("appProtocol")."://",$redirect);
}
return $this->redirect($redirect);
} }