Issue:
- User logs in with https://example.com/login
- Authentication is approved
- As configured in security.yml Symfony2 redirects user to profile page after login.
- But it redirects them to the wrong url http://example.com/homepage
security.yml:
security:
encoders:
FOS\UserBundle\Model\UserInterface: sha512
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
providers:
fos_userbundle:
id: fos_user.user_provider.username_email
firewalls:
main:
pattern: ^/
form_login:
check_path: /login_check
login_path: /login
default_target_path: /profile
provider: fos_userbundle
logout:
path: /logout
target: /splash
anonymous: ~
access_control:
- { roles: ROLE_USER, requires_channel: https }
- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https }
acl:
connection: default
Environment Architecture:
The Server1 and Server2 holds Symfony2 application.
Question:
How to force Symfony to generate redirect URL with https protocol instead http?
So far I have looked at these docs, and the solution didn't work work in my case: