Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

CORS issue with a third party API call from a confluence page


I have a piece of javascript code embedded on a confluence page which intends to retrieve results from a third party API. Whenever I execute the javascript code with the call to the RESTfull API I get the following error message:

  • Access to fetch at '' from origin '' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.


This Confluence page is hosted on a server owned by my company but I don't have admin access to the server. Does anyone know how I can solve this CORS issue? Below the code I'm using:

<!DOCTYPE html>

<button onclick="AccountBalance()">Get Balance</button>

'use strict'

function AccountBalance() {
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Basic xpto");

var raw = JSON.stringify({

"testcaseId": "123456",
"database": "kpi",
"table": "Main"


var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
credentials: 'include',
redirect: 'follow'


fetch('', requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));




1 answer

0 votes
Fabian Lim Community Leader Dec 31, 2021

Hi @Renato Veloso

I found this thread that may assist. Link:

If you still have issues open a support ticket with atlassian.


Hi @Fabian Lim 

I think the issue described on that thread (and the recommended solution), does not apply to my problem since I don't have admin access to the confluence server.

I have access to the confluence web pages where I can edit these web pages with some built-in forms available on confluence (HTML code, SQL query, etc) but I dont see how I can "Add the header via Tomcat by adding the following to <confluence-install>/confluence/WEB-INF/web.xml:

    <!-- Tomcat built in CORS implementation -->
    <!-- End of built in CORS implementation -->

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence Cloud

🏠 Say hello to the new Confluence Home!

Hi Atlassian Community, My name is DJ Chung, and I’m a Product Manager on the Confluence Cloud team. Today, I’m excited to share a new and improved version of Home. The new Home helps you ...

43,756 views 33 137
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you