CORS: Support regular expressions for origin to match against

This commit adds regular expression support for the allow-origin
header depending on the value of the request `Origin` header.

Relates #5601
Closes #6891
I'd really appreciate if we had a real test for this that set a regexp that doesn't match and then we fire a real HTTP request one time with the user agent set and one time without it and see if the response code is correct? Can REST tests do that? if not let's do a simple unit test