- Ensure the CORS policy is added to your API Management instance. This involves adding the <cors> element to the inbound policy in APIM.
https://learn.microsoft.com/en-us/azure/api-management/enable-cors-power-platform
https://www.cloudfronts.com/azure/how-to-solve-cors-error/#:~:text=,headers%3E%0A%0A%3C%2Fcors
- CORS policy can be applied globally (to all APIs) or at a specific API level. Remember that specific APIs and operations inherit policies from their parent APIs, so ensure the <base/> element is present where needed.
- In the policy, include the origin URL (e.g., https://bop.aygulyazilim.com) in the <allowed-origins> section.
- If you have other policies (like <rate-limit>) before the <cors> policy, this could cause CORS errors. Ensure that the <cors> policy is at the beginning of your inbound policy.
- If you're using product-level CORS settings, be aware that these settings only work when subscription keys are passed in query strings. Adjust the order of inbound policies at the product level if necessary.
- Avoid duplicate CORS settings at different levels, as this can cause conflicts. Check the effective policy to see which CORS setting is applied first and adjust accordingly.
- If custom headers like "ocp-apim-subscription-key" are used, make sure they're included in <allowed-headers> of your CORS policy.
- Pay attention to the terminate-unmatched-request attribute in your CORS policy, especially for non-preflight requests. This setting controls how APIM processes cross-origin requests that don't match CORS policy settings.