REDROOM
PHP 8.3.31
Path:
Logout
Edit File
Size: 2.69 KB
Close
/home/getspomw/royalsquad.us/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php
Text
Base64
<?php namespace Illuminate\Http\Middleware; use Closure; use Fruitcake\Cors\CorsService; use Illuminate\Contracts\Container\Container; use Illuminate\Http\Request; class HandleCors { /** * The container instance. * * @var \Illuminate\Contracts\Container\Container */ protected $container; /** * The CORS service instance. * * @var \Fruitcake\Cors\CorsService */ protected $cors; /** * Create a new middleware instance. * * @param \Illuminate\Contracts\Container\Container $container * @param \Fruitcake\Cors\CorsService $cors * @return void */ public function __construct(Container $container, CorsService $cors) { $this->container = $container; $this->cors = $cors; } /** * Handle the incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return \Illuminate\Http\Response */ public function handle($request, Closure $next) { if (! $this->hasMatchingPath($request)) { return $next($request); } $this->cors->setOptions($this->container['config']->get('cors', [])); if ($this->cors->isPreflightRequest($request)) { $response = $this->cors->handlePreflightRequest($request); $this->cors->varyHeader($response, 'Access-Control-Request-Method'); return $response; } $response = $next($request); if ($request->getMethod() === 'OPTIONS') { $this->cors->varyHeader($response, 'Access-Control-Request-Method'); } return $this->cors->addActualRequestHeaders($response, $request); } /** * Get the path from the configuration to determine if the CORS service should run. * * @param \Illuminate\Http\Request $request * @return bool */ protected function hasMatchingPath(Request $request): bool { $paths = $this->getPathsByHost($request->getHost()); foreach ($paths as $path) { if ($path !== '/') { $path = trim($path, '/'); } if ($request->fullUrlIs($path) || $request->is($path)) { return true; } } return false; } /** * Get the CORS paths for the given host. * * @param string $host * @return array */ protected function getPathsByHost(string $host) { $paths = $this->container['config']->get('cors.paths', []); if (isset($paths[$host])) { return $paths[$host]; } return array_filter($paths, function ($path) { return is_string($path); }); } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 8
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
AddLinkHeadersForPreloadedAssets.php
816 B
lrw-rw-rw-
2025-09-17 06:53:03
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
CheckResponseForModifications.php
539 B
lrw-rw-rw-
2025-09-17 06:53:03
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
FrameGuard.php
499 B
lrw-rw-rw-
2025-09-17 06:53:03
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
HandleCors.php
2.69 KB
lrw-rw-rw-
2025-09-17 06:53:03
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
SetCacheHeaders.php
2.81 KB
lrw-rw-rw-
2025-09-17 06:53:03
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
TrustHosts.php
3.04 KB
lrw-rw-rw-
2025-09-17 06:53:03
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
TrustProxies.php
5.49 KB
lrw-rw-rw-
2025-09-17 06:53:03
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ValidatePostSize.php
1.21 KB
lrw-rw-rw-
2025-09-17 06:53:03
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).