My logout target path sends request by HTTP protocol. All on server works by HTTPS protocol. How to say that after logout redirect should be by HTTPS protocol?
Asked
Active
Viewed 580 times
1 Answers
1
There are two ways of doing this with Symfony 4.
- Force HTTPS for an range of urls (Symfony Docs) with "requires_channel":
# config/packages/security.yaml
security:
# ...
access_control:
# ...
# catch all URLs starting with /api/user
- { path: '^/api/user', roles: ROLE_USER, requires_channel: https }
- Doing this for one Action as Annotation (Symfony Docs) with "schemes":
// src/Controller/SecurityController.php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
class SecurityController extends AbstractController
{
/**
* @Route("/api/user/logout-end", name="api-user-logoutEnd", schemes={"https"})
*/
public function apiUserLogoutEnd()
{
// ...
}
}
It could be that "Logout" is https, but the following site is not. Then you can apply the methods on that route, too.

CasualBen
- 829
- 8
- 22