Refactor handling cors for multiple domains. Also refactor name from hosts into domains.
Merge pull request #5929 from czolnowski/fix-cors-multiple-domains-split

CORS refactoring