Allowed HTTP Methods
Optional Restrict certain HTTP methods to be used in your application.
This middleware works by default for *
HTTP Methods and will throw an 405 Method Not Allowed
error when the there will be a request sent with an HTTP Method that is not allowed.
ℹ Read more about restricting HTTP methods here.
It will help you solve this security problem.
Usage
This middleware is disabled globally by default. You can customize it both globally and per route like following:
nuxt.config.ts
export default defineNuxtConfig({ // Global security: { allowedMethodsRestricter: ['GET'] } // Per Route routeRules: { '/my-secret-route': { security: { allowedMethodsRestricter: ['GET'] } } }})
You can also disable the middleware globally or per route by setting allowedMethodsRestricter: false
.
Options
Rate limiter accepts following configuration options:
type HTTPMethod = 'GET' | 'POST' | 'DELETE' | 'PATCH' | 'POST' | string;type AllowedHTTPMethods = HTTPMethod[] | '*'
HTTP Method
- Default:
*
An array of allowed HTTP methods or '*'
to allow all methods.
Table of Contents