mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-12-21 06:19:38 +08:00
Remove redundant middleware
This commit is contained in:
parent
298b6edf66
commit
23a9f018ca
@ -27,7 +27,6 @@ class Kernel extends HttpKernel
|
||||
protected $middlewareGroups = [
|
||||
'web' => [
|
||||
\App\Http\Middleware\EncryptCookies::class,
|
||||
\App\Http\Middleware\RedirectIfUrlEndsWithSlash::class,
|
||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
|
@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class RedirectIfUrlEndsWithSlash
|
||||
{
|
||||
public function handle($request, \Closure $next)
|
||||
{
|
||||
if (substr($request->getRequestUri(), -1) == '/') {
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
// Try to remove slash at the end of current url
|
||||
$newUrl = substr($request->getRequestUri(), 0, -1);
|
||||
|
||||
if ($newUrl != $baseUrl) {
|
||||
return redirect(Str::replaceLast($baseUrl, '', $newUrl));
|
||||
}
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user