Search code examples
symfonysecurityhttpslogoutsymfony-security

Security firewall logout path redirects to http instead of https protocol


Security firewall logout path redirects to http instead of https protocol.

I've tried adding annotation parameters, like: schemes={"https"}

Also I added in security.yaml, the path to the logout route.

- { path: /api/v1/user/logout-result, requires_channel: https }

Still to no luck. Is there anything else I could do?


Solution

  • I managed to fix my issue.

    I removed the target property from logout and added success_handler, which points to my custom service class.

    The custom service class auto-injects the RouterInterface and its function

    public function onLogoutSuccess(Request $request)

    returns new RedirectResponse object which points to the /api/v1/user/logout-result route.