Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
hapi-405-routes
Advanced tools
Plugin for Hapi.js to include 405 Method Not Allowed Responses on routes for a given set of methods.
This plugin registers additional routes with your hapi service for routes with specific methods not implemented.
Say you have a farming web service has an api with only 2 routes:
GET /farm/goats // route which retrieves data about all goats on the farm.
POST /farm/goats // route which allows for creation of additional goats.
By default, hapi responds with a 404 if there is not route/method match registered with the service. If a user were to request OPTIONS /farm/goats
they would get a 404 response.
This plugin builds additional routes based on the route paths already implemented which will respond with a 405 status code. Using this plugin and requesting OPTIONS /farm/goats
will respond with a 405 Method Not Allowed.
Additionally the 405 routes can be configured to respond with an allow
header specifying which methods are allowed for the requested route path. See [options](# Options) below.
This plugin is available through an npm module.
npm install hapi-405-routes
This plugin must be registered after the implemented routes have already been registered with the service.
// my service routes
server.route(routes);
// this 405 route plugin
server.register([
{
register: require('hapi-405-routes'),
options: {
methodsToSupport: ['GET', 'DELETE', 'PATCH', 'POST', 'OPTIONS'],
setAllowHeader: true,
log: true
}
}
]);
This plugin supports 4 options passed in during plugin registration: methodsToSupport
, setAllowHeader
, allowHeadWithGet
, and log
.
Array<String>
['GET', 'POST', 'DELETE', 'PUT', 'PATCH', 'OPTIONS', 'TRACE']
Boolean
false
Boolean
false
allow
header with each 405 response containing the methods implemented for the related route path.Boolean
false
HEAD
with the allow header if a GET
method is implemented for the related route path. (Hapi does not natively support HEAD
methods)FAQs
Allows 405 'Method Not Allowed' responses for hapi routes
We found that hapi-405-routes demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.