Skip to content

Commit

Permalink
Proxying behaviour docs (#132)
Browse files Browse the repository at this point in the history
* add small example on proxying behaviour

* Fix incorrect custom resource section
  • Loading branch information
Kyle Hodgetts authored Dec 2, 2021
1 parent 405334b commit 1344994
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ spec:
[(Back to top)](#table-of-contents)
See [Custom Resources](https://kubeshop.github.io/kusk-gateway/customresources/) for how to develop Kusk Gateway.
See [Custom Resources](https://kubeshop.github.io/kusk-gateway/customresources/) for more information on the Custom Resources that Kusk Gateway supports.
## Troubleshooting
Expand Down
22 changes: 22 additions & 0 deletions docs/extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,28 @@ The path object contains the following properties to configure service endpoints
| rewrite_regex.pattern | Regular expression to rewrite the URL |
| rewrite_regex.substitution | Regular expression's substitution |

If a rewrite isn't specified then the upstream service will receive the request as is with any path still appended.

#### Example

We have a service `foo` with a single endpoint `/bar`.

We configure Kusk Gateway to forward traffic to the `foo` service when it receives traffic on a path with the prefix `/foo`.

![path rewrite example](img/rewrite-path-example.png)

If we receive a request at `/foo/bar`, the request will be forwarded to the `foo` service. `foo` will throw a 404 error as it doesn't have a path `/foo/bar`.

Therefore we must rewrite the path from `/foo/bar` to `/bar` before sending it onto the `foo` service.

The following config extract will allow us to do this
```
path:
# /foo/bar/... -> to upstream: /bar/...
rewrite:
pattern: "^/foo"
substitution: ""
```
### qos
The QoS objects contains the following properties to configure quality of service for endpoints:
Expand Down
Binary file added docs/img/rewrite-path-example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1344994

Please sign in to comment.