Extract URL patter in preflow

Not applicable

Is there a way to extract url pattern in preflow ?

I want to extract url pattern in preflow like /abc/{id}/xyz. The pattern should be like /abc/{id}/xyz.

Is there a variable which can be captured in url pattern in same pattern /abc/{id}/xyz

0 3 315
3 REPLIES 3

Hi @akshay.anand9 --

You can use the ExtractVariables policy to match URI patterns and extract variables from them. Please see this information in the docs. There are lots of examples. There are also variables (proxy.basepath and proxy.pathsuffix for example) that capture entire parts of the client request path.

Hope this points you in the right direction. If this is not what you're looking for, you might need to explain your use case in more detail.

Will

Hi @wwitman

Thanks for answering the question.

My question is more towards , is there a way i can get the pattern coming in URL captured.

eg : https://www.example.com/abc/id/xyz

so is there a way I can capture the pattern coming URL i.e. /abc/{id}/xyz

As I define in extarct variable url pattern to get the values of variable specified in curly braces.

I want to get the pattern of incoming url request.

I can do it with a regex , but is there a way to capture the pattern.

Hi @akshay.anand9 - I believe the best way to do this is with regex/conditions, as described in this doc. I don't think there's an easy way to get part of a pathsuffix using something like proxy.pathsuffix.3.

You might also check this community post for some sample JS code do index elements of proxypath.