Hi everyone,
We recently had a problem where a website that relied on the UVA Dataverse APIs reported that they were getting CORS Policy errors and could no longer make API calls successfully. It broke around the same time that we upgraded from 6.6 to 6.9. We're not currently restricting what domains can use APIs, so we set the JVM option using the command from the update instructions in 6.7:
'bin/asadmin create-jvm-options -Ddataverse.cors.origin=*'
I was able to get the API working again by deleting the 'dataverse.cors.origin' option and setting it as a MicroProfile Config setting instead with:
'bin/asadmin set-config-property --propertyName=dataverse.cors.origin --propertyValue=* --source=domain'
While I was troubleshooting, I did find that if I used '
https://example.com' instead of '*', then the appropriate CORS headings were produced. So it looks like it's '*' specifically that causes problems. I tried a lot of experimenting with escaping '*' and putting it in quotes, but that didn't get me anywhere.
I'm writing mostly to share my solution in case anyone else also runs into this problem, since I didn't see that it had been reported anywhere else, but also to ask if there's a better way to handle this. I'm pretty new to Payara, so it would not surprise me if there was something I missed. Thanks,