I'm using Laravel in an application that I would like to be HTTPS-only.
In one view that is shown on https://example.com/p I open a form like this:
{{ Form::open(['method' => "POST", "id" => "whatever"]) }}
Laravel parses it to this:
<form method="POST" action="http://example.com/p" accept-charset="UTF-8" id="whatever">
This looks good on the first sight, but remember, this is on an HTTPS page so I get a mixed-content warning when displaying the page.
But it gets even worse. I configured my server to redirect HTTP request to the according HTTPS resource. That means, my browser posts the form content to the server, which redirects it to the HTTPS-location. The browser then drops the POST-request and sends a regular GET-request to the server which results in exactly the same page the use has seen before.
Why does Laravel fill in the wrong protocol? How can I set the right one?
Define your routes with https option and call that route to form action.
For Example"
Route
Route::group(array('https'), function(){
// all of our routes
//for your form acction
Route::post('form', array('as' => 'form/action', 'uses' => 'ExampleController@postForm'));
}
So the route under https group should be https, even route for form to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With