Fix CORS origin header handling
Support wildcard CORS origin config
replace payload with result
Close #1091
Merge pull request #1116 from spumko/issue/1111

CORS origin bug fixes and enhancements