Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request Rewrite Example #598

Open
base698 opened this issue Feb 25, 2022 · 0 comments
Open

Request Rewrite Example #598

base698 opened this issue Feb 25, 2022 · 0 comments

Comments

@base698
Copy link

base698 commented Feb 25, 2022

For something like:

rules:
  example-user-router:
    # default route is reader cluster
    next_route: example-reader-cluster

    input_source: path
    input_type: string
    operation: rmatch      # perform regex match against the path to see if it matches 'writer
    operation_arg: '^.*%7Bmylabel%3D%22([a-z0-9]{3})%22.*$'
    cases:
      rmatch-true:
        matches: [ 'true' ] # rmatch returns true when the input matches the regex; update next_route
        next_route: example-writer-cluster

Trying to take the capture group above and add into the hostname as a prefix. Basically like a relabel_config in prometheus. I didn't see an examples on how to do it. Most of the examples for rewrites involve fixed values like here: https://github.com/trickstercache/trickster/blob/main/docs/request_rewriters.md#header-set

Looking through the source:

[]string{"param", "set", "param2", "${trickster}"},

Looks like that uses a ${trickster} var. Don't see where it originated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant