Make behavior for unknown hosts pattern deterministic

Currently Neos is displaying a random site if the request comes from an unrecognized host pattern. That should be made a bit more deterministic especially in scenarios if a bunch of subdomains of a main domain is hosted a single server.

I see several options here:

  • Define a default site-node in Settings like i suggested here neos-neosio
  • Throw an error if no host pattern matches and more than one site is present. (That breaks stuff that previously worked in the moment a second site is created
  • maybe some other clever solution
1 Like

As mentioned today in the meeting I would rather prefer an error message for an unrecognized host pattern over a random site to show up.

I thought about that a bit further.

If we throw an error if more than one site exists and no host pattern matches we have the weird situation that perfectly working sites stop working in the moment a second site is created.

Maybe a default ordering in the siteRepository could help.

1 Like

The problem with default ordering in SiteRepository is that the only properties that makes any sense would be the siteNodeName or the title.

The node name cannot be edited after creation and the title is used in many other places and ‘00 My Default Site’ is actually quite ugly.

I don’t think ordering is the way to go. If anything a default site, similar to the default domain could work IMHO.

In that case we are back to the pr where a default siteNodeName is defined in the Settings. I see no good solution in the Site-domain model.

PS: Offcourse the implementation in the pr above is shitty because it was a prototype the tried to be non breaking . Since we are heading to a breaking release anyway we can rename getFirstActiveSite to getDefaultSite and change the behavior. As soon as we agree how to do it i will gladly create a new pr.

I polished and rebased the old pr that added a defautSiteNodeName Setting.

I could not simply reopen it because github did’nt like the rebase.