Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to remove a groovy filter from zuul (filterRegistry)? #385

Open
MAAARKIN opened this issue Dec 12, 2017 · 5 comments
Open

How to remove a groovy filter from zuul (filterRegistry)? #385

MAAARKIN opened this issue Dec 12, 2017 · 5 comments

Comments

@MAAARKIN
Copy link

Currently i put my .groovy zuulfilter in the folder and they are added to my gateway but how to remove this filter dynamically, how can i do that?

looking in the source code FilterLoader.java has putFilter(File file) but not removeFilter(File file).

its possible to remove?

@MAAARKIN
Copy link
Author

Anybody know's if this is possible?

@artgon
Copy link
Contributor

artgon commented Jan 28, 2018

I don't believe there's any functionality for that.

@MAAARKIN
Copy link
Author

thx @artgon i will create then, i need in my project.

@sandy-adi
Copy link

@artgon, If I want to add a new route to Zuul my understanding is that one of the ways to do that would be to drop a Groovy file in the filters folder. Is this the only way today or is there a better way to do this? @MAAARKIN do you have an idea?

@pinpan
Copy link

pinpan commented Sep 23, 2019

putFilter(File file) of FilterLoader wil first remove previous registration of the plugin provided by the given file. Then it will try to register it again. Here the trick comes: If you place in the filters folder a file with the same name but not containing a valid class, zuul will unregister your filter and then will fail to register it again throwing corresponding exception. This is of course not nice, so a better option is to make the filter class "abstract". Zuul will check this before registering the filter again and if it is true, the will silently exit the registration method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants