Open marckamerbeek opened 5 years ago
hi,
firstly, your policy already exists. It's called "Transform Headers" (https://github.com/gravitee-io/gravitee-policy-transformheaders)
secondly, you need to add the policy in the "Design" section of the api.
@NicolasGeraud Sorry for not being clear...my goal was to investigate how to make my own policy. I know about all the policies added to gravitee by default. My own policy is loaded:
08:57:04.899 [gravitee] [] INFO i.g.p.c.internal.PluginRegistryImpl - > gravitee-policy-add-jwt [1.0.0-SNAPSHOT] has been loaded
But I don't see it in the list in the design section in the UI. I restarted the UI, API and the Gateway. I'm still missing something...
Hi @marckamerbeek
Did you deploy the zip into plugins
directory for both API Gateway AND Management-API ?
Ahhhhh....that should be the missing thing...I only added it in the gateway. I was assuming (yeah, mother of all....) that it should only be added on one place. I thought the management api was communicating with the gateway about the available policies. I'm gonna add it right away!
@marckamerbeek How is it going ?
It was the missing piece ?
Not yet..Got some production issues I had to take care of. Now I'm making a new docker file with the plugin copied in, but its crashing in Kubernetes. I'll let you know as soon it runs again.
Ok.
To add your custom policy, let me advice you to make use of environment variables. Please have a look to the sample from a docker-compose: https://github.com/brasseld/jugsummercamp-2018/blob/master/docker-compose.yml#L77
(It should also be done for both components ;) )
Yes...it works! Thank you very much. I could not find this in the manual.
But now I have another question. Is it possible to add a policy for all the endpoints? Like a default policy. Every call on our gateway needs the same set of policies.
Yep, I did not yet put that part in documentation... too many things should be done about documentation :(.
But now I have another question. Is it possible to add a policy for all the endpoints? Like a default policy. Every call on our gateway needs the same set of policies.
Just put the policies on the default /
and they will be applied for all subpaths.
Hey, no worries....i'm impressed already by the work you guys have been doing. Learned a lot while playing around.
I work for a very big ecommerce company in the Netherlands and have the tasks to look for a new API Gateway. We have been using Zuul for a while now, but missing a UI for admistration, api gallery, subscription...etc. Already did some perfomance comparisons between those two. Zuul looks quite the same as Gravitee. Both performing really well.
I'll check that / for defaults.
I was building my own policy to test how it works. Just a simple policy that adds something in a header on the request and response.
Created a policy project according to the maven archetype provided by the policy documentation of gravitee.io. Build it an got an zip file with the policy in it. Build a new docker container and added the plugin to /opt/graviteeio-gateway/plugins.
Deployed the gateway as a docker container in Kubernetes. Gateway is working fine together with the UI and Manager. It sees my plugin:
Expected Behavior
See a header on the response and some logging of the system.out in std-out.
Current Behavior
The policy is shown in the startup logging of gravitee, but thats it. Nothing else happens if a request is processed.
Am I missing something? Do I need to register it somewhere? I added the generated policy zip file.
Your Environment
gravitee-policy-add-jwt-1.0.0-SNAPSHOT.zip