Azure-functions-host: Proxy configuration with parameterized backend uri fails to load

Created on 12 Sep 2018  路  7Comments  路  Source: Azure/azure-functions-host

Azure Functions Core Tools (2.0.1-beta.37)

Repro steps

  1. Create a proxies.json configuration file with a parameterized route
  2. Pass the parameter to the host name part of the backend
{
    "$schema": "http://json.schemastore.org/proxies",
    "proxies": {
        "createorder": {
            "matchCondition": {
                "methods": [
                    "POST"
                ],
                "route": "/tenants/{tenantName}/people"
            },
            "backendUri": "https://{tenantName}.thedomain.com/people/",
            "debug": true
        }
    }
}
  1. func host start

Expected behavior

Func host to load configuration and route calls to backend using specified template

Actual behavior

Func host fails to process the configuration
[2018-09-12 19:13:14] Error processig configuration of Function Proxies

Most helpful comment

Hi all,

Any update in this issue. I was expected the following would work as documentation isn't mentioning that host part of backendUri is treated any different from rest of the URL.

"backendUri": "https://{request.headers.blah}.my_domain.com",

And storing this in app settings isn't working for us as we need to be dynamic and captured from in incoming request.

FYI @brettsam

For reference documentation mentions:

Set the backend URL to another endpoint. This endpoint could be a function in another function app, or it could be any other API. The value does not need to be static, and it can reference application settings and parameters from the original client request.

In reality the above sentence isn't true and only applies to the part of backendUri after host name.

All 7 comments

I'm seeing the same error when using application settings for the hostname on version 2.4.419 (latest as of now).

The docs specifically say to do this, which causes the above error:

Use application settings for back-end hosts when you have multiple deployments or test environments. That way, you can make sure that you are always talking to the right back-end for that environment.

@safihamid - Any ideas on this issue?

The backend host can only be updated from app settings. cc @vfedonkin in case he has some thoughts.

Any timeline to fix this?

@jonwrede,
About app settings, it works. If you use proxy config as
"test": {
"matchCondition": {
"methods": [
"GET"
],
"route": "/test"
},
"backendUri": "http://%TEST%",
}
And define application setting "TEST" as a valid url, for example "httpbin.org", it works well.

About dynamic urls from the parameters like
"backendUri": "https://{tenantName}.thedomain.com/people/"
It's just not supported and we don't have any plans to implement this feature yet.

I'm facing this issue, same repo steps as the first comment

I'm using Azure functions core tools 3.0.2009 & .NET core 3.1

proxies.json
```JSON{
"$schema": "https://json.schemastore.org/proxies",
"proxies": {
"s": {
"matchConditions": {
"methods": [
"GET"
],
"route": "%Search::Endpoint%"
},
"backendUri": "http://%Search::Backend%",
"debug":true
}
}
}

local.settings.json
```JSON
    "IsEncrypted": false,
    "Values": {
        "Search::Endpoint" : "api/v1/Application/Search",
        "Search::Backend" : "/api/v1/Search",
        "App::Host": "localhost:7071",
    }
}

@vfedonkin I've defined the backendUri in app settings as you suggested, when I run the app I get the error :Error processig configuration of Function Proxies

Hi all,

Any update in this issue. I was expected the following would work as documentation isn't mentioning that host part of backendUri is treated any different from rest of the URL.

"backendUri": "https://{request.headers.blah}.my_domain.com",

And storing this in app settings isn't working for us as we need to be dynamic and captured from in incoming request.

FYI @brettsam

For reference documentation mentions:

Set the backend URL to another endpoint. This endpoint could be a function in another function app, or it could be any other API. The value does not need to be static, and it can reference application settings and parameters from the original client request.

In reality the above sentence isn't true and only applies to the part of backendUri after host name.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

paulbatum picture paulbatum  路  4Comments

alaatm picture alaatm  路  4Comments

yvele picture yvele  路  3Comments

horihiro picture horihiro  路  3Comments

silencev picture silencev  路  4Comments