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

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

問題

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.

原因

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.

回避策

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();






最終更新日 2021 年 4 月 16 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.