Clone URL from a Mirror is not available due to CORS policy violations

お困りですか?

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

コミュニティに質問


プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

要約

The clone URL from a Bitbucket mirror is not available and does not show up under the dropdown list for repository clone URLs.

Here's a sample clone URL from a mirror:


However, in the scenario described in this Knowledge base article, the clone URL is not shown in the dropdown even though there are no issues with the synchronization of projects and repositories from the upstream to the mirror.

The mirror clone URL is not available because the request to load the clone URL is possibly blocked by Cross-Origin Resource Sharing (CORS) security policies at the client-side.

環境

Bitbucket Data Center with Smart Mirrors or Mirror Farms

診断

Confirm that there are no issues with synchronization of projects and repositories from the upstream to the mirror by checking the mirror log files for any errors. Please check the links under Troubleshooting Smart Mirroring.

To troubleshoot possible CORS policy violations at the client-side:

  • Generate a HAR file while loading the clone URLs for a repository
  • Check the browser's Console logs for any error messages while loading the clone URLs

Sample Case 1: multiple "Access-Control-Allow-Origin" headers

In this specific example, the request was blocked due to CORS security policy because there was more than one "Access-Control-Allow-Origin" header.

HAR file content

The HAR file excerpt shows that there are two "Access-Control-Allow-Origin" headers

...
    {
      "name": "Access-Control-Allow-Origin",
      "value": "*"
    },
    {
      "name": "Access-Control-Allow-Origin",
      "value": "https://<upstream>"
    },
...

Browser Console log output

Access to XMLHttpRequest at 'https://<mirror>/bitbucket/rest/mirroring/latest/upstreamServers/<upstream-id>/repos/<repo-id>?jwt=<token>' from origin 'https://<upstream>' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header contains multiple values '*, https://<upstream>', but only one is allowed.

原因

The request was blocked due to CORS security policy violations.

Sample Case 1

For this case, the issue was due to misconfiguration in the reverse proxy in front of the mirror where an additional "Access-Control-Allow-Origin: *" was being added by the proxy.

ソリューション

Sample Case 1

Review the reverse proxy configuration and remove the setting that was adding the extra "Access-Control-Allow-Origin: *".

最終更新日: 2021 年 2 月 1 日

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

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