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);
|
|
|
|
|
2018-09-20 13:27:34 -05:00
|
|
|
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;
|
2021-02-09 10:28:06 -06:00
|
|
|
use RKA\Middleware\IpAddress;
|
2023-05-07 06:18:19 -05:00
|
|
|
use Shlinkio\Shlink\Common\Middleware\AccessLogMiddleware;
|
2021-02-12 02:24:13 -06:00
|
|
|
use Shlinkio\Shlink\Common\Middleware\ContentLengthMiddleware;
|
2024-02-04 07:16:42 -06:00
|
|
|
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' => [
|
2019-11-22 11:01:38 -06:00
|
|
|
'error-handler' => [
|
2018-12-07 12:46:46 -06:00
|
|
|
'middleware' => [
|
2023-05-07 06:18:19 -05:00
|
|
|
AccessLogMiddleware::class,
|
2021-02-12 02:24:13 -06:00
|
|
|
ContentLengthMiddleware::class,
|
2021-12-19 03:23:55 -06:00
|
|
|
RequestIdMiddleware::class,
|
2018-12-07 12:46:46 -06:00
|
|
|
ErrorHandler::class,
|
2021-08-16 05:49:15 -05:00
|
|
|
Rest\Middleware\CrossDomainMiddleware::class,
|
2019-11-22 11:01:38 -06:00
|
|
|
],
|
|
|
|
],
|
2019-11-22 12:49:14 -06:00
|
|
|
'error-handler-rest' => [
|
|
|
|
'path' => '/rest',
|
|
|
|
'middleware' => [
|
|
|
|
ProblemDetails\ProblemDetailsMiddleware::class,
|
|
|
|
],
|
|
|
|
],
|
2019-11-22 11:01:38 -06:00
|
|
|
|
|
|
|
'pre-routing' => [
|
|
|
|
'middleware' => [
|
2018-12-07 12:46:46 -06:00
|
|
|
Common\Middleware\CloseDbConnectionMiddleware::class,
|
|
|
|
],
|
2017-03-24 15:10:25 -05:00
|
|
|
],
|
|
|
|
|
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,
|
2016-07-03 01:40:39 -05:00
|
|
|
],
|
|
|
|
],
|
|
|
|
|
2017-03-24 15:10:25 -05:00
|
|
|
'rest' => [
|
|
|
|
'path' => '/rest',
|
|
|
|
'middleware' => [
|
2020-04-08 10:27:26 -05:00
|
|
|
Router\Middleware\ImplicitOptionsMiddleware::class,
|
2018-09-20 13:27:34 -05:00
|
|
|
Rest\Middleware\BodyParserMiddleware::class,
|
2018-09-24 12:24:23 -05:00
|
|
|
Rest\Middleware\AuthenticationMiddleware::class,
|
2017-03-24 15:10:25 -05:00
|
|
|
],
|
|
|
|
],
|
|
|
|
|
2019-11-22 12:49:14 -06:00
|
|
|
'dispatch' => [
|
2016-07-03 01:40:39 -05:00
|
|
|
'middleware' => [
|
2020-04-08 10:27:26 -05:00
|
|
|
Router\Middleware\DispatchMiddleware::class,
|
2019-11-22 12:49:14 -06:00
|
|
|
],
|
|
|
|
],
|
|
|
|
|
|
|
|
'not-found-rest' => [
|
|
|
|
'path' => '/rest',
|
|
|
|
'middleware' => [
|
|
|
|
ProblemDetails\ProblemDetailsNotFoundHandler::class,
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'not-found' => [
|
|
|
|
'middleware' => [
|
2021-02-09 10:28:06 -06:00
|
|
|
// This middleware is in front of tracking actions explicitly. Putting here for orphan visits tracking
|
|
|
|
IpAddress::class,
|
2021-02-08 14:38:19 -06:00
|
|
|
Core\ErrorHandler\NotFoundTypeResolverMiddleware::class,
|
2021-07-15 09:54:54 -05:00
|
|
|
Core\ShortUrl\Middleware\ExtraPathRedirectMiddleware::class,
|
2021-02-08 14:38:19 -06:00
|
|
|
Core\ErrorHandler\NotFoundTrackerMiddleware::class,
|
2019-11-23 03:25:12 -06:00
|
|
|
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
|
|
|
];
|