1

I'm using latest version of laravel 5.2, I want to run the hole app on HTTPS protocol

what I found from searching is:

  1. setup a filter, but filter.phpis not found any more in this version
  2. setup the server in somehow to make it, but I couldn't because I'm new
  3. implementing a middleware, I couldn't understand it too

I want to implement https in my application, what is the best way and how? I would be thankful for a detailed answer.

Note: developing on local host, XAMP used, Windows 10.

Poula Adel
  • 609
  • 1
  • 10
  • 33
  • It sounds like you need to do some more research to understand the problem you are trying to solve. Post some code and someone will be able to help – nagyben Jul 24 '16 at 18:23
  • 2
    refrences : http://stackoverflow.com/questions/19967788/laravel-redirect-all-requests-to-https http://stackoverflow.com/questions/38554636/laravel-make-laravel-5-app-use-https http://stackoverflow.com/questions/28402726/laravel-5-redirect-to-https – Poula Adel Jul 24 '16 at 18:27

1 Answers1

1

You could use middleware:

class HttpsMiddleware {

    public function handle($request, Closure $next)
    {
        if ( ! $request->secure() && app()->environment() === 'production') {
            return redirect()->secure($request->path());
        }

        return $next($request);
    }
}
Dan
  • 6,265
  • 8
  • 40
  • 56