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
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
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.
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.
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
Open Portal Management App:
Navigate to Site Settings:
Create or Modify Settings for CORS:
Enter CORS Header Information:
https://learn.microsoft.com/en-us/power-pages/configure/cors-support?WT.mc_id=DX-MVP-5004029
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!
WarrenBelz
146,668
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,004
Most Valuable Professional