Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirects and HTTPs #68

Closed
thePanz opened this issue Jul 24, 2020 · 7 comments · Fixed by #86
Closed

Redirects and HTTPs #68

thePanz opened this issue Jul 24, 2020 · 7 comments · Fixed by #86
Labels
documentation Documentation needs adjustment help wanted

Comments

@thePanz
Copy link
Contributor

thePanz commented Jul 24, 2020

When configuring a route with a redirect like:

# routes/routes.yaml
legacy_homepage:
    path: /
    controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::urlRedirectAction
    defaults:
        path: '/home'

The redirect it always using the http schema, if the TRUSTED_PROXIES environment is not set. When setting it, the redirect works perfectly.

This behavior should be mentioned in the readme, wdty?

@maxhelias
Copy link
Collaborator

maxhelias commented Jul 27, 2020

I don't know, it's more a proxy / Symfony issue. Maybe a note on this section should be good : https://symfony.com/doc/current/routing.html#redirecting-to-urls-and-routes-directly-from-a-route

@walva
Copy link

walva commented Aug 16, 2020

Hello,

I have this issue today by testing facebook. I had to accept https, which I did by updating my docker environment with #60. Then, I notice the url generated when I was browsing with https//mydomain.local, the urls generated with the router start with instead of https. What a tried to do is forcing schemes={"https"}.

    /**
     * @Route("/contact", name="website.contact", schemes={"https"})
     */
    public function contact(Request $request)
    {}

The app still think it is in http instead of https so it will redirect infinitely.

thanks @thePanz because your issue helped me !

@thePanz
Copy link
Contributor Author

thePanz commented Aug 17, 2020

@walva : did you try un-commenting the TRUSTED_PROXIES setting in the .env?

@walva
Copy link

walva commented Aug 17, 2020

Sorry @thePanz, my message was unclear. Uncommenting ´TRUSTED_PROXIES´ did fix the issue.

@maxhelias
Copy link
Collaborator

@thePanz after reflection, a note in this section https://github.com/dunglas/symfony-docker/blob/master/docs/troubleshooting.md would be welcome

@thePanz
Copy link
Contributor Author

thePanz commented Nov 16, 2020

@maxhelias see #86 :)

@maxhelias
Copy link
Collaborator

let's continue in #86

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Documentation needs adjustment help wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants