JayKey
JayKey

Reputation: 177

How to tell Symfony2 not to use https?

I have a Symfony2 website and domain with ssl. Every time I try to login or logout Symfony redirects me from http to https. I know that login should have secure connection, but right now I need to force Symfony not to use ssl. How can I do it?

Upvotes: 2

Views: 1534

Answers (1)

Fidan Hakaj
Fidan Hakaj

Reputation: 7163

Symfony2 configuration

Via app/config/security.yml file

There you have probably set the requires_channel property to https.

access_control:
    - path: ^/login
      roles: IS_AUTHENTICATED_ANONYMOUSLY
      requires_channel: https

So to not force the use of https, just remove this property.

Have a look at the doc about forcing https or http with the security config.

Via routing files

In routing files, you can force http or https with the schemes property.

secure:
    path:     /secure
    defaults: { _controller: AcmeDemoBundle:Main:secure }
    schemes:  [https]

So again, to not force the use of https, just remove that property.

Have a look at the doc about forcing https or http with the routing component.

Apache configuration

It is also possible to force https via .htaccessfiles with the rewrite module. If the two previous ways didn't work, check your .htacess files for rewrite rules/conditions.

Upvotes: 3

Related Questions