47 lines
1.2 KiB
PHP
47 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* Purifying.php
|
|
*
|
|
* PHP version 7
|
|
*
|
|
* @category Middleware
|
|
* @package App\Http\Middleware
|
|
* @author XE Developers <developers@xpressengine.com>
|
|
* @copyright 2020 Copyright XEHub Corp. <https://www.xehub.io>
|
|
* @license http://www.gnu.org/licenses/lgpl-3.0-standalone.html LGPL
|
|
* @link https://xpressengine.io
|
|
*/
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use Closure;
|
|
|
|
/**
|
|
* Class HttpProtocol
|
|
*
|
|
* @category Middleware
|
|
* @package App\Http\Middleware
|
|
* @author XE Developers <developers@xpressengine.com>
|
|
* @copyright 2020 Copyright XEHub Corp. <https://www.xehub.io>
|
|
* @license http://www.gnu.org/licenses/lgpl-3.0-standalone.html LGPL
|
|
* @link https://xpressengine.io
|
|
*/
|
|
class HttpProtocol
|
|
{
|
|
/**
|
|
* Handle an incoming request.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @param \Closure $next
|
|
* @return mixed
|
|
*/
|
|
public function handle($request, Closure $next)
|
|
{
|
|
if (app('config')->get('xe.ssl.always') == true && $request->secure() == false) {
|
|
return redirect()->secure($request->getRequestUri());
|
|
}
|
|
|
|
return $next($request);
|
|
}
|
|
}
|