web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Pages
Answered

Remove CORS Error

(0) ShareShare
ReportReport
Posted on by 57

Hi Everyone,
Can you please tell me how to remove CORS error in power page portal using site settings or any other method to remove this error.
Thank you

Categories:
I have the same question (0)
  • EmadBeshai Profile Picture
    806 Moderator on at

    Hi @_Mayank ,

     

    First, the Cors shouldn't be handled from the client side neither power pages nor any JS framework like angular, react.. etc, but it should be handled from the backend.

     

    If you are trying to call power automate with http trigger then I recommend you to use fetch to call your URL, please check the below link

    https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch

     

    Please mark this answer as accepted if it helps you, thank you!

  • Jcook Profile Picture
    7,781 Most Valuable Professional on at

    Hi @_Mayank 

    to address the CORS error in the Power Page portal, you would need to configure the related HTTP headers via the Portal Management app

    1. Open Portal Management App:

      • Launch the Portal Management app from your Microsoft Power Platform environment.
    2. Navigate to Site Settings:

      • Once in the Portal Management app, look for a section called 'Website' and within that, you'll find 'Site Settings'. Click on this to access the settings for your site.
    3. Create or Modify Settings for CORS:

      • Within 'Site Settings', you have the option to create new settings or modify existing ones.
      • To create a new setting, click 'New'.
      • To modify an existing setting, click on the setting you wish to modify from the list.
    4. Enter CORS Header Information:

      • For each CORS header you want to set, you’ll create a new site setting or modify an existing one.
      • In the 'Name' field, you’ll enter the name of the CORS header you are setting, for example: HTTP/Access-Control-Allow-Origin.
      • In the 'Value' field, you’ll enter the value for this header, for example, the URL of the allowed domain or * for allowing any domain.

    https://learn.microsoft.com/en-us/power-pages/configure/cors-support?WT.mc_id=DX-MVP-5004029

     

     

  • _Mayank Profile Picture
    57 on at

    Hi @Jcook ,

    Thank you for giving me an answer in such detail with a document link, but I've tried all those steps and it's still not working for me can you please give me an example with all headers in the site setting or screenshots of previously done site settings to remove CORS error.
    Thank you.

  • Verified answer
    Jcook Profile Picture
    7,781 Most Valuable Professional on at

    Hi @_Mayank 

     

    I am unable to fully replicate your issue.

    Can you confirm that you have Site settings as follows:

    1. Access-Control-Allow-Credentials:
    • Name: HTTP/Access-Control-Allow-Credentials
    • Value: true (only if credentials are needed)
    2. Access-Control-Allow-Headers:
    • Name: HTTP/Access-Control-Allow-Headers
    • Value: Content-Type, Authorization (or other headers as per your requirement)
    3. Access-Control-Allow-Methods:
    • Name: HTTP/Access-Control-Allow-Methods
    • Value: GET, POST, OPTIONS
    4. Access-Control-Allow-Origin:
    • Name: HTTP/Access-Control-Allow-Origin
    • Value: https://your-allowed-domain.com or * (to allow all origins)
    5. Access-Control-Expose-Headers:
    • Name: HTTP/Access-Control-Expose-Headers
    • Value: Header1, Header2 (replace with your actual header names)
    6. Access-Control-Max-Age:
    • Name: HTTP/Access-Control-Max-Age
    • Value: 86400 (or the desired cache duration in seconds)

    These entries should be created or modified within the ‘Site Settings’ section of the Portal Management app. Each entry corresponds to a specific CORS header that is being set or modified.

     

    NOTE that these Names in the site settings must match exactly.

     

  • _Mayank Profile Picture
    57 on at

    Thanks @Jcook 

  • _Mayank Profile Picture
    57 on at

    Hi @Jcook ,
    It's not working 😞
    Still shows CORS error.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 89 Super User 2025 Season 2

#2
Jerry-IN Profile Picture

Jerry-IN 75

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard