updated function routing section to correct the last section about header-based template parameters and to clarify some of the magic happening there
@@ -113,7 +113,7 @@ Let's see how this plugin works by creating some routes to these functions in th
Great! We just called our first function through Gloo.
-1. Parameters can also come from headers. Let's tell Gloo to look for `id` in a custom header.
+1. Parameters can also come from headers. Let's tell Gloo to look for `id` in a header.
Let's take a look at the route we created:
@@ -148,9 +148,8 @@ Let's see how this plugin works by creating some routes to these functions in th
name: default-petstore-8080
namespace: gloo-system
- We need to add a route with a parameter that tells Gloo how to grab template parameters from the request.
+ We can tell Gloo to grab the template parameters from the request with a flag called `rest-parameters` like this:
- Add `parameters` to the route's `extensions` like so:
glooctl add route \
--path-prefix /petstore/findWithId/ \
@@ -158,7 +157,6 @@ Let's see how this plugin works by creating some routes to these functions in th
--rest-function-name findPetById \
--rest-parameters ':path=/petstore/findWithId/{id}'
- Now Gloo knows to look for the parameter named `id` in a header called `x-pet`.
Try `curl` again, this time with the new header:
@@ -166,6 +164,13 @@ Let's see how this plugin works by creating some routes to these functions in th
{"id":1,"name":"Dog","status":"available"}
+ You may be asking "why are you calling that a header, it's not a header"? We're actually calling the service
+ with a path parameter, but in HTTP2 a header called `:path` is used to pass the path information around. At the
+ moment, since Envoy has [built everything internally around HTTP2](https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/http_connection_management),
+ we can use this `:path` header to pull template
+ parameters. We could have used another header like `x-gloo` to pass in and then create our `rest-parameters`
+ with the `x-gloo` header and acomplish the same thing. We'll leave that as an exercise to the reader.
+
Tutorials for more advanced use-cases are coming soon. In the meantime, please see our plugin documentation<!--(TODO)-->
for a list of available plugins and their configuration options.
\ No newline at end of file
