I have a Slim 4 app running and set some recurring url param as a base path to not show this in url generation.
Request flows:
- Call to
http:demo.xyz?p1=a
---> rewrite tohttp://slim.app/url/demo.xyz?p1=a
through a Varnish proxy - Call to
http://slim.app/url/demo.xyz?p1=a
directly
Both calls need to work.
Inside a middleware I set /url/demo.xyz
as base path so the URLs generated are http://demo.xyz?p1=a
.
The problems with this are:
- The base path is not recognized by
routes.php
as something to pass params, sourl/abc
is not matched. - I still need to have the value of the
url
param to fetch some things inside the Slim app. - My routes need to match this structure to work with both request flows.
$app->group('/url/{url}', function (RouteCollectorProxy $group) {
$group->get('[/[/city/{city}]]', IndexAction::class)->setName('home');
//...
});
Any idea to get this to work?
This is connected to the question placed here.