My current approach is to add a mapping configuration like for the existing URL mapping.
The basic form would be:
This would map www.domain1.com to /domain and otherdomain to /other.
We could also assume these mappings to be regular expressions, eg.
which would map both www.domain1.com and domain1.com to /domain1
This would of course present some reversemapping issues in that it is unclear how to reverse map a resource /domain1/statics/site.css. So we would have
Thus splitting incoming and outgoing mapping.
Of course another approach without using regular expressions would be to use multiple entries mapping to the same root path:
Here resolution of incoming requests would still resolve domain1.com and www.domain1.com to /domain1. But reverse mapping would map /domain1/statics/site.css to www.domain1.com/statics/site.css since the mappings are applied in a first-match-applies approach.