Jira is appending x-atlassian-mau-ignore to all outgoing browser remote requests

Still need help?

The Atlassian Community is here for you.

Ask the community

Problem

When custom code is executed in the browser, remote requests generated with help of XHR or "fetch" will have x-atlassian-mau-ignore header automatically appended. This may cause problems if those remote requests are destined for remote servers, and may cause CORS-related errors if those servers aren't lenient about the headers on incoming requests.

Cause

Atlassian Analytics plugin is bundled by default with all Jira installations, and is responsible for attaching this header to all requests generated with XHR or fetch. Frontend of Jira does not intend for the code to be sending requests to servers other than Jira, the expectation is that the frontend code would contact the backend code, which in its turn might run remote request to third-party servers. This way a uniformity is achieved and the front-end code does not have to rely on the third-party connectivity from individual workstations, but rather enforce uniformity through the backend which operates in a predictable environment.

Workaround

It is possible to programmatically disable the hooks in XHR and fetch before sending requests to third-party servers from the front-end code like this:

// disable the hooks before creating and executing the remote request
require('atlassian/analytics/user-activity-xhr-header').uninstall();
// create and send your request
var xhr = new XmlHttpRequest();
...
xhr.send();
// re-enable the hooks after your request
require('atlassian/analytics/user-activity-xhr-header').install();






Last modified on Apr 16, 2021

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.