Skip to main content

Notifications

Community site session details

Community site session details

Session Id : rDqXwab89qCLOb4SifmCKv
Power Pages - General Discussions
Answered

Remove CORS Error

Like (0) ShareShare
ReportReport
Posted on 19 Oct 2023 07:04:54 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:
  • _Mayank Profile Picture
    57 on 01 Nov 2023 at 08:04:32
    Re: Remove CORS Error

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

  • _Mayank Profile Picture
    57 on 25 Oct 2023 at 07:38:45
    Re: Remove CORS Error

    Thanks @Jcook 

  • Verified answer
    Jcook Profile Picture
    7,770 Most Valuable Professional on 24 Oct 2023 at 22:57:32
    Re: Remove CORS Error

    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 20 Oct 2023 at 05:20:42
    Re: Remove CORS Error

    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.

  • Jcook Profile Picture
    7,770 Most Valuable Professional on 19 Oct 2023 at 20:55:25
    Re: Remove CORS Error

    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

     

     

  • EmadBeshai Profile Picture
    806 Super User 2025 Season 1 on 19 Oct 2023 at 19:50:06
    Re: Remove CORS Error

    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!

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,668 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard
Loading started