I have an "Is this going to work?" question.
I'm building a multi-tenanted application. DNS and Apache will be configured so that multiple subdomains will point to the site.
site1.example.com
site2.example.com
site3.example.com
etc ...
I am going to use the value returned by $request->getHost() to deliver different content depending on the subdomain.
For most requests, I will derive and validate an integer site_id value from the host name. That will be used in database queries to retrieve and deliver the appropriate content.
I will also be using twig sub templates using {% render url(route) %} where the action for the sub template route will deliver custom content based on the host. It might render a unique template with the name constructed using the host name.
I want users to be able to switch between "sites" without having to login again. I can set the domain for the PHP session cookie and Symfony's "remember me" cookie to .example.com (note the dot).
I've done some simple tests with this idea and it seems to work. Are there any issue or gotchas that I'm forgetting about? I don't want to do something that not really supported. I'm a little nervous about things like caching etc. Is Symfony happy with me accessing the site with multiple host names?
I've enabled the Symfony reverse proxy and this still seems to work okay although app/cache/prod/http_cache always seems to be empty so I guess the caching is not really working. That's a different subject I guess. I need to learn more about the caching but in general, is the Symfony reverse proxy going to be happy with this? Is the cache based on the full URL or just the route?
I know there's the new routing by host name feature. I don't think that's useful to me here because I want the same action methods to execute regardless of host.
I think I'm okay but I'd really appreciate any comments before I commit to this.
Thanks