Azure App Service - RESTful API with CORS

I've azure node.js app and developed a set a RESTful APIs.

Now, I am developing a chrome extension to interact with the node.js app through REST call. I was facing the cross origin issue since my azure app was restricting the chrome extension from accessing the data.

Problem: I've followed the below steps to enable CORS,

  1. Home -> All Resources -> App Name -> Under API -> CORS
  2. Tried to add origin chrome-extension://some_id, it wasn't allowing since only http/https are allowed.
  3. Added * under Allowed Origins, still the extension throws allow origin access error

Questions:

  1. Is it possible to allow a origin which is a chrome extension?
  2. If yes, how do we do it? if no, is there any alternative?

1 answer

  • answered 2018-07-11 07:07 Lee Liu

    It is possible. We need to declare cross domain permissions in the permissions property of Manifest.

    For example, if we want to design an extension to get Wikipedia data and display it in other web pages, we should make the following statement in Manifest:

    {
        ...
        "permissions": [
            "*://*.wikipedia.org/*"
        ]
    }
    

    In this way, Chrome will allow your expansion to request content from Wikipedia on any page.