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;
|
2020-04-08 10:27:26 -05:00
|
|
|
use Mezzio\Helper;
|
2020-01-01 14:11:53 -06:00
|
|
|
use Mezzio\ProblemDetails;
|
2020-04-08 10:27:26 -05:00
|
|
|
use Mezzio\Router;
|
2020-02-19 11:58:22 -06:00
|
|
|
use PhpMiddleware\RequestId\RequestIdMiddleware;
|
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' => [
|
2020-04-08 10:27:26 -05:00
|
|
|
Helper\ContentLengthMiddleware::class,
|
2018-12-07 12:46:46 -06:00
|
|
|
ErrorHandler::class,
|
2019-11-22 11:01:38 -06:00
|
|
|
],
|
|
|
|
],
|
2019-11-22 12:49:14 -06:00
|
|
|
'error-handler-rest' => [
|
|
|
|
'path' => '/rest',
|
|
|
|
'middleware' => [
|
2019-11-29 12:24:04 -06:00
|
|
|
Rest\Middleware\CrossDomainMiddleware::class,
|
2020-02-19 11:58:22 -06:00
|
|
|
RequestIdMiddleware::class,
|
2019-11-22 12:49:14 -06:00
|
|
|
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-08 14:38:19 -06:00
|
|
|
Core\ErrorHandler\NotFoundTypeResolverMiddleware::class,
|
|
|
|
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
|
|
|
];
|