I invoke jira REST API in use Confluence user marco by javascript. And error reported.

After get above error, I do below action:
1. Enable allow list between my Jira and Confluence, both inbox and outbox are in the allow list and show green on both allow list page;
2. My Jira behind nginx 1.20 reverse proxy. So I add below configuration in my nginx.conf
add_header 'Access-Control-Allow-Origin' 'https://mydomain.com';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization';
if ($request_method = 'OPTIONS')
{ add_header 'Access-Control-Allow-Origin' 'https://mydomain.com';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization';
add_header 'Content-Length' 0; return 204; }
But still got above CORS error.
Please help on this case. I had been blocked for 1 day.
Thank you very much!