locked
CORS issues with static website + Azure Functions RRS feed

  • Question

  • The issue is well illustrated on this website: https://sergoniawebsite.azurewebsites.net

    I have it set up so that when the form is submitted, I call the function (nothing special there, just check's if params exist and returns a simple body, almost the default http trigger function).

    I have added the static website url to the allowed origins list in the Azure Portal. I even tried it with * there, but I am still getting the CORS error:

    Access to XMLHttpRequest at 'https://sergoniawebsite.azurewebsites.net/api/sergonia-form-submit?name=test&contact=test&message=test' from origin 'https://sergonius.z16.web.core.windows.net' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

    It's as if the allowed origins are not even set in the Portal.

    I am not looking for alternative solutions (via proxies or what ever, although I also tried that), I wish this functionality just worked as I expected (perhaps my expectations are wrong?).

    I went though all the possible settings for both the storage and functions in the Azure Portal with a support person and we didn't come to a conclusion.


    • Edited by sirgova Friday, April 12, 2019 7:35 AM normal url
    Friday, April 12, 2019 7:31 AM

Answers

  • It is quite weird that you are experiencing this issue. Can you try to remove all the CORS entries from Azure Functions app and handle it directly in your code.

    Also Go through these GitHub and SO threads and see if that helps.

    In the post, you have mentioned that you have worked with the support person can you share support case number so that I can check it internally.

    Monday, April 15, 2019 3:25 AM

All replies

  • It is quite weird that you are experiencing this issue. Can you try to remove all the CORS entries from Azure Functions app and handle it directly in your code.

    Also Go through these GitHub and SO threads and see if that helps.

    In the post, you have mentioned that you have worked with the support person can you share support case number so that I can check it internally.

    Monday, April 15, 2019 3:25 AM
  • Sure enough, having it in code worked! Very funky.

    Is this behaviour somehow expected or is there a problem with the service?

    No trace of a ticket however, we had a live chat and used the desktop sharing app. All I can remember is that the guys last (or second) name was Roy, if that is of any help.

    In any case, thanks a lot!

    Monday, April 15, 2019 5:50 AM
  • I am glad that the issue is resolved. It is expected to work from portal also but it might be the portal glitch. 
    Monday, April 15, 2019 6:51 AM