shlink/config/autoload/middleware-pipeline.global.php

82 lines
2.4 KiB
PHP
Raw Normal View History

2016-04-10 02:38:07 -05:00
<?php
2019-10-05 10:26:10 -05:00
2017-10-12 03:13:20 -05:00
declare(strict_types=1);
namespace Shlinkio\Shlink;
2020-01-01 14:11:53 -06:00
use Laminas\Stratigility\Middleware\ErrorHandler;
use Mezzio\ProblemDetails;
2020-04-08 10:27:26 -05:00
use Mezzio\Router;
use RKA\Middleware\IpAddress;
use Shlinkio\Shlink\Common\Middleware\AccessLogMiddleware;
use Shlinkio\Shlink\Common\Middleware\ContentLengthMiddleware;
use Shlinkio\Shlink\Common\Middleware\RequestIdMiddleware;
2021-02-11 06:52:36 -06:00
2016-04-10 02:38:07 -05:00
return [
2016-04-17 12:34:16 -05:00
2016-04-10 02:38:07 -05:00
'middleware_pipeline' => [
'error-handler' => [
'middleware' => [
AccessLogMiddleware::class,
ContentLengthMiddleware::class,
RequestIdMiddleware::class,
ErrorHandler::class,
Rest\Middleware\CrossDomainMiddleware::class,
],
],
'error-handler-rest' => [
'path' => '/rest',
'middleware' => [
ProblemDetails\ProblemDetailsMiddleware::class,
],
],
'pre-routing' => [
'middleware' => [
Common\Middleware\CloseDbConnectionMiddleware::class,
],
],
2016-04-10 02:38:07 -05:00
'routing' => [
'middleware' => [
2020-04-08 10:27:26 -05:00
Router\Middleware\RouteMiddleware::class,
Router\Middleware\ImplicitHeadMiddleware::class,
],
],
'rest' => [
'path' => '/rest',
'middleware' => [
2020-04-08 10:27:26 -05:00
Router\Middleware\ImplicitOptionsMiddleware::class,
Rest\Middleware\BodyParserMiddleware::class,
Rest\Middleware\AuthenticationMiddleware::class,
],
],
'dispatch' => [
'middleware' => [
2020-04-08 10:27:26 -05:00
Router\Middleware\DispatchMiddleware::class,
],
],
'not-found-rest' => [
'path' => '/rest',
'middleware' => [
ProblemDetails\ProblemDetailsNotFoundHandler::class,
],
],
'not-found' => [
'middleware' => [
// This middleware is in front of tracking actions explicitly. Putting here for orphan visits tracking
IpAddress::class,
Core\ErrorHandler\NotFoundTypeResolverMiddleware::class,
Core\ShortUrl\Middleware\ExtraPathRedirectMiddleware::class,
Core\ErrorHandler\NotFoundTrackerMiddleware::class,
Core\ErrorHandler\NotFoundRedirectHandler::class,
Core\ErrorHandler\NotFoundTemplateHandler::class,
2016-04-10 02:38:07 -05:00
],
],
],
2020-04-08 10:27:26 -05:00
2016-04-10 02:38:07 -05:00
];