Hi,
I have a project where Varnish is used in front of a Slim 4 project. Due to some project specialities, the original url should be hidden and the incoming request is rewritten to some other headers.
Example
- Original call to demo.xyz is coming to Varnish
- Varnish is transforming the request to
http://slimapp.dev/url/demo.xyz
- The original host is saved in the header with
X-Orig-Host: demo.xyz
The Slim App needs to detect if it is a Varnish request (I already got that) and needs to transform the routes.
So when creating a route with url_for
(Twig-View package) the urls should be generated like that:
- Route w/o Varnish:
http://slimapp.dev/url/demo.xyz/article/123
- Route w/ Varnish:
http://demo.xyz/article/123
Ideas:
- Modify the original UriInterface object but I have no idea how.
- Write a TwigExtension for Twig-View to modify the methods for
url_for
and so on.
Any idea what to do?
Thanks in advance!