As of now, from what I see, the only way to use Azure Function Proxy is to re-route an existing api is to call upon that api directly. For example:

Backend URL

https://gateway-api.com/api/getSomething

Route Template

/api

Proxy URL

https://gateway.azurewebsites.net/api

What I want is to have the Backend URL pass through any endpoint relative to the main endpoint.

Effectively this:

Backend URL

https://gateway-api.com/* or i even tried this https://gateway-api.com/{*restOfPath}

This way, any api's that follow the core domain URL will still work as expected.

Here is a re-write of the example above:

Backend URL 2

https://gateway-api.com/*

Route Template 2

/*

Proxy URL 2

https://gateway.azurewebsites.net/api/getSomething

When I do this I can't get it to work or even reach the debuger to log anything.

Is this possible and if not would this be something Azure API Management would be able to accomplish?

1

There are 1 best solutions below

4
Cindy Pau On

Can you provide your configuration file? this is mine:

Proxies.json:

{
  "$schema": "http://json.schemastore.org/proxies",
  "proxies": {
    "proxy1": {
      "matchCondition": {
        "methods": [ "GET" ],
        "route": "/{test}"
      },
      "backendUri": "http://localhost:7071/abc/Function1"
    }
  }
}

host.json:

{
  "version": "2.0",
  "extensions": {
    "http": {
      "routePrefix": "abc"
    }
  },
  "logging": {
    "applicationInsights": {
      "samplingExcludedTypes": "Request",
      "samplingSettings": {
        "isEnabled": true
      }
    }
  }
}

This is the backend url and proxy of my function:

enter image description here

Both of them works fine.

If you change route template, I think the backend url will not have /api unless you give the /api to routePrefix.

Any way, please show the file about how to configure proxy and route template.