Can I use request metadata, like the host domain, in an Azure table storage filter?

Viewed 84

I have a function with an httpTrigger, and I'd like to use the domain and the path (the route in the trigger binding) to look up a value in a table store. The function app will have multiple domains pointing to it, so I want to use the request domain as part of the filter.

Filtering based on the route/path works fine, but I can't find any information about using other parts of the request.

How can I provide the request host or URL to the table binding as part of a filter?

Here's my function.json:

{
  "bindings": [
    {
      "authLevel": "anonymous",
      "type": "httpTrigger",
      "route": "{path}",
      "direction": "in",
      "name": "req",
      "methods": [
        "get"
      ]
    },
    {
      "name": "redirectRule",
      "type": "table",
      "take": "1",
      "filter": "Host eq '{????}' and Path eq '{path}'",
      "tableName": "RedirectRules",
      "connection": "StorageConnectionAppSetting",
      "direction": "in"
    },
    {
      "type": "http",
      "direction": "out",
      "name": "res"
    }
  ]
}

Where I have {????}, I'd like to use something like req.headers.host (which doesn't work). Is this possible?

0 Answers
Related