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

Limit requests at the endpoint / component / module level #77

Open
codyjdalton opened this issue Jan 25, 2019 · 0 comments
Open

Limit requests at the endpoint / component / module level #77

codyjdalton opened this issue Jan 25, 2019 · 0 comments

Comments

@codyjdalton
Copy link
Owner

codyjdalton commented Jan 25, 2019

Is your feature request related to a problem? Please describe.
In order to prevent DDOS/other attack vectors, it would be good to set a rate limit on the endpoint or module level

Describe the solution you'd like
What would be nice is if I could do something like the following:
For modules:

@LitModule({
    rateLimit: {
        windowMs: 15 * 60 * 1000, // 15 minutes
        max: 100 // limit each IP to 100 requests per windowMs
    },
    exports: [
       ...
    ],
    imports: [
        ...
    ]
})
export class AppModule {

}

For components, maybe something like:

@LitComponent({
    rateLimit: {
        windowMs: 15 * 60 * 1000, // 15 minutes
        max: 100 // limit each IP to 100 requests per windowMs
   }
})
export class AppComponent {
    @GetMapping({
        produces: AppConstants.MESSAGE_V1,
        rateLimit: {
              windowMs: 15 * 60 * 1000, // 15 minutes
              max: 100 // limit each IP to 100 requests per windowMs
        }
    })
    home(res: HttpResponse) {
        res.success({
            message: AppConstants.WELCOME_MESSAGE
        });
    }
}

Describe alternatives you've considered
Alternative would be to add a middleware to the application or endpoint handling the rate limiting

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