question

another-aaron avatar image
0 Votes"
another-aaron asked ozkary answered

azure functions app: sudden CORS issue (for like no reason)

getting the client origin error, after i had been hitting with a client from localhost for hours:

> Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource

why would my azure function service suddenly change like this?

not-supported
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

another-aaron avatar image
0 Votes"
another-aaron answered
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Grmacjon-MSFT avatar image
0 Votes"
Grmacjon-MSFT answered

Hi Aaron,

It looks like your question was answered on MSDN. posting here for visibility.

"To prevent malicious code execution on the client, modern browsers block requests from web applications to resources running in a separate domain. Cross-origin resource sharing (CORS) lets an Access-Control-Allow-Origin header declare which origins are allowed to call endpoints on your function app."

Refer - https://docs.microsoft.com/en-us/azure/azure-functions/functions-how-to-use-azure-function-app-settings#cors

Please let us know if you have further questions.



Thanks,

Grace

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

OculisDev-1598 avatar image
0 Votes"
OculisDev-1598 answered JoseAndrsEspinozaBonilla-7376 commented

Hi Grace,
I have similar issue with my react client reaching api in Azure functions. I have added the web application url to function app CORS policy to allow access, but I am still getting same issue.

Access to XMLHttpRequest at 'functtionappUrl from origin 'Website Url' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Any advise please?

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi Grace, did you find the answer, I am trying the same scenario, but nothing works , Azure Function - SignalR and Front End React

Thanks for your comments

0 Votes 0 ·
ozkary avatar image
0 Votes"
ozkary answered

Hi,

 Use the local.settings.json settings in your project. For the CORs settings to kick in, run the project in debug mode. Just running from the CLI may not work.

"Host": {
"LocalHttpPort": 7071,
"CORS": "*",
"CORSCredentials": false
}

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.