0

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?

Christian Matthew
  • 4,014
  • 4
  • 33
  • 43

1 Answers1

0

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.

Cindy Pau
  • 13,085
  • 1
  • 15
  • 27
  • I don't understand. This isn't what I was askinig. I know how to make the proxy work. that's not my question – Christian Matthew May 29 '20 at 12:36
  • @ChristianMatthew Can you explain about [this](https://i.stack.imgur.com/dfoYp.png)? I am sorry to misunderstanding. I'm not sure what do you mean. Can you explain about this? – Cindy Pau May 29 '20 at 13:29
  • that's ok if you reread the question the ask is how can i forward the url to any backend url. essentially that is what I am asking – Christian Matthew May 29 '20 at 13:52
  • @ChristianMatthew Do you mean hitting any other backend URL you want to hit through a proxy URL? Do you mean this? – Cindy Pau May 29 '20 at 15:04