Manage CORS rules

更新时间:
复制 MD 格式

On the CORS Configuration page, you can view and manage your CORS rules.

Enable or disable a CORS rule

If you set a rule's status to Disabled or Enabled when you create it, you can change the status later. In the rule list, click Enable or Disable in the Actions column.

Note
  • Environment-level rules:

    • If you enable an environment-level rule, it applies to all APIs. However, if an API has a specific rule attached, the attached rule takes precedence.

    • If you disable the environment-level rule, only the rules attached to specific APIs are enforced.

  • API-level rules:

    • If you enable or disable an API-level rule, the change affects all APIs attached to that rule.

    • To disable the rule for a specific API, detach the API from the rule. To enable it again, reattach the API to the rule.

Edit a CORS rule

  1. You can open the rule editing page in one of the following two ways:

    • On the rule list page, click Edit in the Actions column for the desired rule.

    • Click the rule name to go to its details page and then click Edit in the upper-right corner.

  2. The Edit CORS page is identical to the creation page. You can modify all settings except for the CORS Name.

  3. Click OK to save your changes to the CORS rule.

View CORS rule details

On the CORS rule list page, click a CORS rule name to go to its details page.

Attached APIs

On the Attached APIs tab of the rule details page, you can view the APIs that are attached to the rule.

In the list of attached APIs, you can perform the following actions:

  • View API details: Click an API name to go to its details page. On the details page, you can view information about its Configuration, Version Management, Monitoring, Traffic Governance, CORS, Authorization Object, and API Debugging.

  • Filter by frontend protocol type:

    1. Click the filter button next to Frontend Protocol Type.

    2. In the filter box that opens, select a frontend protocol type and click OK.

  • Filter by API status:

    1. Click the filter button next to Status.

    2. In the filter box that opens, select Published or Unpublished, and then click OK.

  • Filter by backend service type:

    1. Click the filter button next to Backend Service Type.

    2. In the filter box that opens, select a backend service type and click OK.

  • Filter by backend protocol type:

    1. Click the filter button next to Backend Protocol Type.

    2. In the filter box that opens, select a backend protocol type and click OK.

  • Search for APIs: In the search box in the upper-right corner of the API list, you can search for attached APIs by name.

  • Change display settings:

    • Change column settings: In the upper-right corner of the API list, click the Column Settings button. In the dialog box that opens, you can select or clear the columns to display in the API list. You can also pin a column to the left or right, or drag columns to change their order.

    • Adjust list density: In the upper-right corner of the API list, click the Density button. In the dialog box that opens, you can adjust the display density of the API list.

Rule Details

On the Rule Details tab, you can view the details of the current CORS rule. The information displayed is the same as the information that you provided during creation.

Delete a CORS rule

On the CORS rule list page, click Delete in the Actions column for the CORS rule that you want to delete. In the confirmation dialog box that appears, click OK.

Note
  • You cannot delete the pinned environment-level rule.

  • You cannot delete a rule that has attached APIs. To delete the rule, you must first detach the APIs.