Closed michalbundyra closed 7 years ago
I'm adding documentation now, but want to note that doc/book/middleware.md
clearly states the following:
The handlers in each middleware attached this way will see a URI with that path
segment stripped, allowing them to be developed separately and re-used under
any path you wish.
Middleware pipped to a path stripped in the original request matched path. So if we attach middleware to path
/api
:$app->pipe('/api', Middleware::class);
and we call/api/foo
our$request
inMiddleware
will contain path/foo
not/api/foo
.Still, it is possible to get original request uri:
$originalUri = $request->getAttribute('originalUri');
but it seems to be odd for me that original request is modified. There is short explanation in the documentation:
I've discussed this issue with @weierophinney on IRC and it's expected behaviour.
It would be nice to update documentation with a bit more explanations, because IMHO changing original request is not something what you can expect.