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

Headers policy: allow templating using liquid #708

Closed
mikz opened this issue May 15, 2018 · 0 comments
Closed

Headers policy: allow templating using liquid #708

mikz opened this issue May 15, 2018 · 0 comments
Assignees
Milestone

Comments

@mikz
Copy link
Contributor

mikz commented May 15, 2018

Use Cases

Add a HTTP Header to the request that contains value parsed from the JWT used for authentication (#607 (comment)).

Using HMAC to hash and sign some value and pass it upstream in the HTTP Request Header.

Details

We should offer both "plain" and "liquid" replacement

It is possible some clients will have "{{ }}" inside their replacement and that would cause an issue.
But maybe that change is negligible and we should always template the string by "liquid".
And last concern is performance - templating it by liquid right now could have performance impact before we make it all JITable.

This can't be a breaking change to the policy configuration.

https://github.com/3scale/apicast/blob/5ec4848a8527143d3764d43bb0c447afdac5b52a/gateway/src/apicast/policy/headers/apicast-policy.json#L42-L45

We could let "value" to be a string or an object {"type":"plain|liquid", "value": "..."}, but that would not work with the UI library (https://github.com/3scale/apicast/issues/6950.

Another way would be to introduce another key "value_type" that is optional enum defaulting to "plain".

Other policies will try to do the same.

Try to keep similar interface and see how other policies need to use liquid templating. One other candidate is the rate limiting policy.

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

2 participants