reverse-proxy icon indicating copy to clipboard operation
reverse-proxy copied to clipboard

Query to Route Transform

Open yilativ opened this issue 4 years ago • 2 comments

I've tried numerous ways to find if this subject has been broached and answered, but could not find a PR or an issue (open or closed) that would tell me so.

Is there a built-in way to do a Transform for the PathPattern or PathSet that will pull the values from the Query and place them to a route?

{ 
"ReverseProxy": { ...#clusters and other configs#
"Routes": { 
  "MyRoute": { 
   "Match": {
      "ClusterId": "MyCluster"
      "Path": "/path/to/somewhere",
      "QueryParameters": [{
         "Name": "SearchType",
         "Mode": "Exists"
      }]
     },
    "Transforms": [
      # Not working with getting the query parameter of "SearchType" above, 
      # into the "PathPattern" (or "PathSet") below
      # Is there a way to have this work natively?
      { "PathPattern": "/internal/{SearchType}" }
    ]   
  } 
}

Is there a way to utilize native Yarp transforms to change the Path pattern and pluck the Query parameter and put it into the transformed path pattern?

Or... is the current solution to this would be a custom transform?

yilativ avatar Jan 04 '22 23:01 yilativ

The PathPattern can only inject values that were matched from the request path, not the query. You'd need a custom transform to pull values from the query.

Tratcher avatar Jan 05 '22 01:01 Tratcher

Thank you @Tratcher

yilativ avatar Jan 05 '22 01:01 yilativ