Enable CORS for Azure Rest webapi application

后端 未结 2 1981
猫巷女王i
猫巷女王i 2021-01-24 10:51

I have simple jQuery page that makes calls to azure restful API to get the status of VMs. I\'m facing a problem that it\'s complaining about Cross-Origin Resource Sharin

2条回答
  •  隐瞒了意图╮
    2021-01-24 11:30

    Okay, here is how to do it in short:

    1. Add Function App (charge per request)
    2. Open the Newly created function app
    3. In Proxies, select that from the right list
    4. Give it a name, route template will be your new endpoint URL, backend URL is your login endpoint eg: https://login.microsoftonline.com//oauth2/token
    5. After that, back to your function app, select the platform feature tab, Select CORS, delete all of them and enter your application URL or simply a *

    You can be more specific with these, but this is enough to get the token. And all the other endpoint didn't have CORS problem.

    Good luck.

提交回复
热议问题