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 create rate limit on custom plugin based on field in the HTTP header? #21

Open
irfansofyana opened this issue Mar 28, 2024 · 0 comments

Comments

@irfansofyana
Copy link

irfansofyana commented Mar 28, 2024

Hi everyone! I need help for my use case.

At the moment, I have a custom plugin that doing authentication to our internal service outside TYK. We have an identifier of who created the request in X-PARTNER-ID header, at the moment our custom plugin looks like this:

// doing http call to our internal auth service here

// inject session
session := &user.SessionState{
  MetaData: map[string]interface{}{
	"partner-id": r.Header.Get("X-PARTNER-ID"),
  },
}

ctx.SetSession(r, session, true)

from the code above, is it possible to add custom rate limit but it should be based on the partner-id field? I don't want it to be a global rate limit and should be based per partner-id

@irfansofyana irfansofyana changed the title How to createa rate limit on custom plugin based on field in the HTTP header? How to create rate limit on custom plugin based on field in the HTTP header? Mar 28, 2024
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

1 participant