I have an Azure Function App with a function at the URL http://localhost:7072/api/create-room
along with other functions. This particular function is a HTTPTrigger
with allowed anonymous access and accepts the GET
verb:
[HttpTrigger(AuthorizationLevel.Anonymous, "get")]
Along with that, I have a separate function app that hosts only a proxies.json
file and serves only as a functions proxy. My proxies function is running on port 7071
locally.
My proxies file currently looks like this:
{
"$schema": "http://json.schemastore.org/proxies",
"proxies": {
"chatNegotiate": {
"matchCondition": {
"route": "/api/chat/negotiate",
"methods": [
"POST"
]
},
"backendUri": "%chat_api%/api/BeginNegotiate"
},
"chatMessages": {
"matchCondition": {
"route": "/api/chat/messages",
"methods": [
"POST"
]
},
"backendUri": "%chat_api%/api/PostMessage"
},
"createRoom": {
"matchCondition": {
"route": "/api/create-room",
"methods": [
"GET"
]
},
"backendUri": "%session_api%/api/CreateRoom"
}
}
}
When both of these function apps are deployed to Azure, everything works like a dream. I can make requests, they're forwarded on, requests come back. It's all glorious.
However, when I run these functions locally, the request is never forwarded on from the proxy, with the proxy returning a 404. I can hit the function on the other function app running locally on 7072
directly and all is well there, but not at all when I got via the proxy.
The proxy itself returns:
[30/05/2020 18:24:30] Host lock lease acquired by instance ID '0000000000000000000000002D5B6BEA'.
[30/05/2020 18:24:34] Executing HTTP request: {
[30/05/2020 18:24:34] "requestId": "9004b8e2-f208-4a98-8b48-6f85bca41281",
[30/05/2020 18:24:34] "method": "GET",
[30/05/2020 18:24:34] "uri": "/api/create-room"
[30/05/2020 18:24:34] }
[30/05/2020 18:24:34] Executed HTTP request: {
[30/05/2020 18:24:34] "requestId": "9004b8e2-f208-4a98-8b48-6f85bca41281",
[30/05/2020 18:24:34] "method": "GET",
[30/05/2020 18:24:34] "uri": "/api/create-room",
[30/05/2020 18:24:34] "identities": [],
[30/05/2020 18:24:34] "status": 404,
[30/05/2020 18:24:34] "duration": 15
[30/05/2020 18:24:34] }
From examples I've looked at such as https://chsakell.com/2019/02/03/azure-functions-proxies-in-action/, this should be working fine.
Any suggestions? Thanks in advance for any help you can provide!