This is something I've been meaning to work on for a while, hoping a real world use case on some project I'm involved with would need it, but oh well... worked on it a bit this morning. Please see this commit to moqui-framework:
With an external CORS filter or proxy this isn't needed (without this change just make sure the CORS filter or proxy handles the full OPTIONS request rather than forwarded it).
In general I'd recommend learning about this stuff before you set things up:
There are various other replies on this mailing list and on GitHub that include the use of a wildcard to allow any origin and that is generally not a good idea. The new default in Moqui is same origin only unless '*' is explicitly configured, as it is now using the 'webapp_allow_origins' property in the MoquiDevConf.xml file (can also be set as a Java property or env var like other default-property instances).
There are various additional CORS related headers added in the MoquiDefaultConf.xml file that you can override in a component or runtime MoquiConf.xml file. This uses the functionality that has been there for a while to add configured headers for different types of requests using the webapp.response-header element in the Moqui Conf XML file.
The allow origins configuration is more complex, can't just be a static value. This new code implements the recommended logic of returning the Origin request header value in the Access-Control-Allow-Origin response header if the origin is allowed, and return a 401 error if the origin is not allowed (many filters don't do this, protects against such requests even if not enforced by the browser, but still relies on the presence of the Origin request header).
For the OP if you need more info on how the Moqui Conf XML file works see:
-David