Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexashley/kong-plugin-path-prefix
A Kong plugin to rewrite the upstream request path
https://github.com/alexashley/kong-plugin-path-prefix
kong kong-plugin lua
Last synced: 3 days ago
JSON representation
A Kong plugin to rewrite the upstream request path
- Host: GitHub
- URL: https://github.com/alexashley/kong-plugin-path-prefix
- Owner: alexashley
- License: mit
- Created: 2018-09-24T16:08:47.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-03-23T01:11:05.000Z (over 2 years ago)
- Last Synced: 2023-03-02T08:32:24.221Z (over 1 year ago)
- Topics: kong, kong-plugin, lua
- Language: Lua
- Homepage:
- Size: 18.6 KB
- Stars: 32
- Watchers: 1
- Forks: 28
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# kong-plugin-path-prefix
A Kong plugin that rewrites the upstream request path. This can be useful if you have routes associated to a single service that all share the same path prefix.
For example, given `/foobar`, `/foobar/version`, and `/foobar/healthz` routes, the resulting upstream request routes will be `/`, `/version`, and `/healthz`, respectively, (assuming that `/foobar` is set as `config.path_prefix`).
This plugin is not compatible with APIs or any version older than Kong `0.14`.
## Usage
Can be installed on either a service or individual routes.
### Schema
| field | explanation | default |
|----------------|----------------------------------------------------------------------|---------|
| `path_prefix` | The prefix shared by all routes associated with the service. | N/A |
| `escape` | Whether any hyphens in the path prefix should be escaped | `true` |
| `forwarded_header` | Add 'X-Forwarded-Prefix' with 'path_prefix' value | `false` |### Versions
The version of Kong that this plugin was last tested against is 2.5.0.
The following branches have versions of the plugin that worked against the name of the branch:
- `0.14.x`
- `1.x.x`## Development
Run `docker-compose up --build` to stand up an instance of Kong with the plugin.
Integration tests can be run with `make test`.