To start, what I am trying to do: I want to call an external api from the user interface. In order not to get a CORS exception I want to add the Access-Control-Allow-Origin header. I understand that I can add an .ic-assets.json file and I could configure my header inside.
Try this, unless the filename you want to affect actually starts with a dot. The example from the documentation you linked is intended to include normally hidden files (which have a filename starting with .) as assets.
Yes, match is a regex. However, that’s not the problem here.
The issue is that dfx doesn’t currently copy the .ic-asset.json files that would be stored alongside your index.html or index.js into the dist/ directory, and so it doesn’t apply any of the rules in that .ic-asset.json file.