Can I preserve subdomain with Yarp?

26 views Asked by At

I have an API that uses subdomains to resolve tenants. I want to have a reverse proxy before said API.

Is it possible to configure YARP so when it receives request with subdomain, it preserves the subdomain and passes the request to another address adding the subdomain?

For example: tenant1.proxy.com/import/something would be passed to tenant1.api.com/something/import but the tenant1 name is dynamic and cannot be set in configuration.

I have tried given configuration without success:

"ReverseProxy": {
  "Routes": {
    "Import": {
      "ClusterId": "Import",
      "Match": {
        "Host": "*.proxy.com",
        "Path": "/import/something"
      },
      "Transforms": [
        {
          "PathSet": "/something/import"
        }
      ]
    }
  },
    "Clusters": {
      "Import": {
        "Destinations": {
          "Import": {
            "Address": "*.api.com"
          }
        }
      }
    }
  }


0

There are 0 answers