php - Auto secure form on Laravel 4.2


I'm using Laravel 4.2 and everything looks fine. But I have a problem with the SSL when I useForm::open() Function. It always using HTTP without SSL even when the site is using SSL.

I saw this question: Laravel: HTTPS in Form::open() But there's 2 problems with that: I need to do it manually for each form. and when I program on my Wamp Server, I have HTTP so it won't work on my localhost.

So my question is, How can I auto secure the form if the site is using SSL?




You can create a route group with thehttps option, and insert all of your routes inside that group.


Route::group(array('https'), function(){
    // All routes goes here

Then your forms should behttps.

Another solution may be just:




You can useRequest::secure() to check if the request is over HTTPS and use the return value in the URL helper like this:

Form::open(array('url' => URL::to('/', array(), Request::secure())))

This way you form should automatically use HTTP or HTTPS depending if the current request is using HTTPS or not.

People are also looking for solutions to the problem: php - Create rows of values from original row keys, and column values (transpose subarray keys & columns)


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.