Azure Function Proxies Configuration is Being Ignored

1k Views Asked by At

I tried creating a simple Azure Functions App through the UI both on Linux and Windows machines and it works. However having a simple proxies configuration seems to be completely ignored. It doesn't work locally either using the provided Docker base image.

The app is using the Node v12 runtime on the latest azure functions runtime ~3, all defaults:

hosts.json

{
  "version": "2.0",
  "extensions": {
    "http": {
      "routePrefix": ""
    }
  },
  "functions": [ "hello" ]
}

hello/function.json

{
  "disabled": false,
  "bindings": [
    {
      "type": "httpTrigger",
      "direction": "in",
      "name": "req",
      "methods": ["get", "post"],
      "route": "/bar",
      "authLevel": "anonymous"
    },
    {
      "type": "http",
      "direction": "out",
      "name": "$return"
    }
  ]
}

hello/index.js

module.exports = async (context, req) => {
  return {status: 200, body: 'ok'}
}

proxies.json

{
  "$schema": "http://json.schemastore.org/proxies",
  "proxies": {
    "something": {
      "matchCondition": {
        "route": "/foo",
        "methods": [
          "GET",
          "POST"
        ]
      },
      "backendUri": "https://[INSERT APP NAME HERE].azurewebsites.net/bar"
    }
  }
}

Navigating to https://[INSERT APP NAME HERE].azurewebsites.net/bar shows the little ok message on the screen.

Navigating to https://[INSERT APP NAME HERE].azurewebsites.net/foo however returns 404.

I tried numerous other proxy configurations and my assumption at this point is that the proxy configuration is being ignored completely. I'm on the free consumption plan if that makes any difference.

0

There are 0 best solutions below