Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

0 votes
Marc - Devoteam
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
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
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
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!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.20
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events