Symfony2 Twig url() https

10,089

The URLs generated by twig are determined by your routing configuration. You need to set the route to require https.

requirements:
    _scheme:  https

You can read more about it here: http://symfony.com/doc/2.0/cookbook/routing/scheme.html

Share:
10,089
Jean-Francois Hamelin
Author by

Jean-Francois Hamelin

Updated on June 28, 2022

Comments

  • Jean-Francois Hamelin
    Jean-Francois Hamelin almost 2 years

    I need to generate an absolute URL that will use the secure HTTP protocol since it's a payment page template used by a third party payment gateway solution that requires every single element on the page to point to or to come from an HTTPS link. Now, I can't for the life of me find how to use the Twig url() function to generate a secure URL. Anything you add to the function in an array is considered a GET parameter that will be appended at the end of the URL in a ?x=y manner.

    How can I generate an HTTPS URL using the Twig url() function???

    Thanks in advance.

  • MrGlass
    MrGlass about 12 years
    the requirements go on each URL definition in your routing. You can set it for whichever URLs you want.