marcosbarbero / spring-cloud-zuul-ratelimit

Rate limit auto-configure for Spring Cloud Netflix Zuul

Home Page:https://blog.marcosbarbero.com/spring-cloud-netflix-zuul-rate-limit/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not able to make policy with url_pattern

bhaktigd opened this issue · comments

I have created several policies for rate limiting with url, http_method and they work fine.
Now I'm trying to create a policy with url_pattern and it does not seem to work.
I have referred to some other issues listed here, but that also didn 't help.

Here is my configuration:

Note: I have also tried with a single * instead of ** , but did not work

zuul.routes.srvconfig.path=/api/gw/*/accounts/**
zuul.routes.srvconfig.url=forward:/api/gw/
#--------------------------------------------------------------------
zuul.ratelimit.policy-list.srvconfig[0].limit=100
zuul.ratelimit.policy-list.srvconfig[0].refresh-interval=60
zuul.ratelimit.policy-list.srvconfig[0].type[0]=http_method=post
#--------------------------------------------------------------------
zuul.ratelimit.policy-list.srvconfig[2].limit=200
zuul.ratelimit.policy-list.srvconfig[2].refresh-interval=60
zuul.ratelimit.policy-list.srvconfig[2].type[0]=url_pattern=/v2/accounts/**/info
zuul.ratelimit.policy-list.srvconfig[2].type[1]=http_method=get
#--------------------------------------------------------------------

Hello @bhaktigd, thanks for getting in touch, we will get back to you asap! If you have issues in the 1.x.x.RELEASE line we recommend you to update to the latest version, unfortunately this line is not supported anymore.

I was able to make this work by providing the complete url in the url_pattern as below:
zuul.ratelimit.policy-list.srvconfig[2].type[0]=url_pattern=appContext/api/gw/v2/accounts/*/info