I am trying to add a custom HTTP header to all of my responses of my Azure Functions - lets call it X-Custom. Then I add a proxies.json file like this to my functions project:
{
"$schema": "http://json.schemastore.org/proxies",
"proxies": {
"add-custom-header-to-response": {
"matchCondition": {
"route": "/{*restOfPath}"
},
"responseOverrides": {
"response.headers.X-Custom": "Custom value"
}
}
}
}
And this works as expected, I do get the X-Custom header, but my response content has gone missing. What am I missing in the proxies.json file?
Update
Thanks to Baskar I came to the solution (I was missing backendUri):
{
"$schema": "http://json.schemastore.org/proxies",
"proxies": {
"add-custom-header-to-response": {
"matchCondition": {
"route": "/api/1/{*restOfPath}"
},
"backendUri": "https://localhost/api/1/{restOfPath}",
"responseOverrides": {
"response.headers.X-Custom": "Custom value"
}
}
}
}
Also see:
https://learn.microsoft.com/en-us/azure/azure-functions/functions-proxies#reference-localhost https://learn.microsoft.com/en-us/azure/azure-functions/functions-proxies#route-template-parameters