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

59 lines
1.7 KiB
PHP
Raw Normal View History

2016-04-10 10:38:07 +03:00
<?php
2017-10-12 11:13:20 +03:00
declare(strict_types=1);
namespace Shlinkio\Shlink;
2017-04-13 10:43:11 +03:00
use Zend\Expressive;
use Zend\Stratigility\Middleware\ErrorHandler;
2016-04-10 10:38:07 +03:00
return [
2016-04-17 20:34:16 +03:00
2016-04-10 10:38:07 +03:00
'middleware_pipeline' => [
'pre-routing' => [
'middleware' => [
ErrorHandler::class,
Expressive\Helper\ContentLengthMiddleware::class,
Common\Middleware\CloseDbConnectionMiddleware::class,
],
'priority' => 12,
],
'pre-routing-rest' => [
'path' => '/rest',
'middleware' => [
Rest\Middleware\PathVersionMiddleware::class,
Rest\Middleware\ShortUrl\ShortCodePathMiddleware::class,
],
'priority' => 11,
],
2016-04-10 10:38:07 +03:00
'routing' => [
'middleware' => [
Expressive\Router\Middleware\RouteMiddleware::class,
],
'priority' => 10,
],
'rest' => [
'path' => '/rest',
'middleware' => [
Rest\Middleware\CrossDomainMiddleware::class,
2018-03-21 02:46:26 +03:00
Expressive\Router\Middleware\ImplicitOptionsMiddleware::class,
Rest\Middleware\BodyParserMiddleware::class,
Rest\Middleware\AuthenticationMiddleware::class,
],
'priority' => 5,
],
'post-routing' => [
'middleware' => [
Expressive\Router\Middleware\DispatchMiddleware::class,
// Only if a not found error is triggered, set-up the locale to be used
Common\Middleware\LocaleMiddleware::class,
Core\Response\NotFoundHandler::class,
2016-04-10 10:38:07 +03:00
],
'priority' => 1,
],
],
];