Hi devs,
Right now the server
field in the wiki descriptor has a different meaning depending if we are in path based or domain based mode:
- domain based: the domain name of the URL
- path based: the alias used to indicate the target wiki in the path
This means there is only two way to know the domain name for external URL in path based mode:
- the URL of the first request
- the property
xwiki.home
inxwiki.cfg
file
This also means there is no way to indicate the domain at wiki level contrary to domain based for which you can use the descriptor.
Since the alias is never used for the main wiki I propose (initially suggested by @gdelhumeau) to change the meaning of the server
field in the main wiki to indicate the domain to use when generating the external URLs no matter the mode.
In term of retro compatibility it means that if an instance in path based has crap in the main wiki descriptor (it’s possible since it’s totally useless right now) and upgrade it might end up with broken external URL (until the main wiki descriptor is fixed) produced by background threads like schedulers and mails. Something that reduce the likelihood of this happening is that the main wiki descriptor is automatically created when it does not exist and the domain of the input URL (which has a good chance of being the good) is set in it.
A possible alternative (which could also be done even if solution A
is chosen) is to get rid of path based vs domain based mode and instead have two fields in the wiki descriptor: the domain and the alias. Then having some logic more or less similar to this:
- if the domain is set in the current wiki descriptor then use it, if not fallback on main wiki descriptor, then first request
- if the alias is set then generate a path based style URL path
WDYT ?
Here is my +1 to change the meaning of server
field in the main wiki descriptor.