'Https requests "invalid request (unsupported ssl request)"
I'm having problems with Https requests in Laravel 5.1
I created a Middleware like this:
<?php
namespace Subway\Http\Middleware;
use Closure;
use App;
use Redirect;
class UseSSL
{
public function handle($request, Closure $next)
{
if (!$request->secure() && env('APP_ENV') === 'local')
{
return redirect()->secure($request->getRequestUri());
}
return $next($request);
}
}
and my routes are like this:
Route::group(['middleware' => 'use.ssl'], function () {
// All other routes here
});
I registered the middleware in kernel.php
protected $routeMiddleware = [
'use.ssl' => \Subway\Http\Middleware\UseSSL::class,
];
When trying to get to any url, the page doesn't load and the terminal is returning this error:
[Thu Nov 12 11:09:30 2015] ::1:50728 Invalid request (Unsupported SSL request)
What's the problem with this?
Solution 1:[1]
Try to past this lines of code:
public function boot()
{
if (!$this->app->isLocal()) {
$this->app['request']->server->set('HTTPS', true);
}
}
into your app/Providers/AppServiceProvider.php file
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | aviboy2006 |
