Skip to content

Standardize requests to lowercase for proxy-cache to work? #7821

Answered by flrgh
tobiasehlert asked this question in Help
Discussion options

You must be logged in to vote

@tobiasehlert if you want to simply normalize/rewrite the uri in-place, this is possible by using the request-transformer plugin with its advanced template feature:

https://docs.konghq.com/hub/kong-inc/request-transformer/#advanced-templates

The uri/path is not injected into the template environment by default, so we'll need to use a route with a uri capture to make it available:

---
name: my-route
paths:
  # this makes `uri_captures.person` accessible to our request-transformer template
  - "/api/greeting/(?<person>.+)"
service: ...
plugins:
  - name: request-transformer
    config:
      replace:
        # here we use the Lua `string.lower()` metamethod to normalize our API path to lowe…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@tobiasehlert
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by tobiasehlert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
2 participants