Search code examples
phpssllaravelcloudflarelaravel-form

Laravel: HTTPS in Form::open()


I'm using SSL for my website (Cloudflare HTTPS) in my login for weh I use ``, Laravel won't convert my website link to SSL version and it shows http version. How can I force Laravel to use https for me?

For example:

<?=Form::open(array('id' =>'submit'))?>

   . . .

<?=Form::close()?>

And the result will be:

<form method="POST" action="http://example.com" accept-charset="UTF-8" id="submit">

</form>

I want action to be a HTTPS link.


Solution

  • If you want to use https you need to manually give path which will be set to action.

    You need to use URL::to this way:

    <?=Form::open(array('url' => URL::to('/', array(), true), 'id' =>'submit' ))?>
    

    to make submit to / url (which will be equivalent to example.com) and pass as 3rd parameter true to make it secure