The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to enable CORS in Jira data center 8.20

Owen
Contributor
July 31, 2024

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

CORS_error.png

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!

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Marc -Devoteam-
Community Champion
July 31, 2024

Hi @Owen 

This has been answered earlier, see cors-error-with-rest-api.

There is also a KB article on it, getting-cors-errors-when-accessing-confluence-resources 

Owen
Contributor
July 31, 2024

The two article did not give an clear solution for such case. 

Marc -Devoteam-
Community Champion
August 1, 2024

Hi @Owen 

The you are impacted by the web.xml change that Atlassian implemented in version above 7.15

See, CONFSERVER-80056 

Owen
Contributor
August 21, 2024

Thanks! Marc

Set the source URL in the Target Jira allowlist is fine.  Sorry for late reply!

DEPLOYMENT TYPE
SERVER
VERSION
8.20
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events