小编zha*_* yu的帖子

disable http method in express js

im doing nessus testing on my express app and here what i get

基于每种方法的测试:

  • HTTP methods ACL CHECKOUT COPY DELETE GET HEAD LOCK MERGE MKACTIVITY MKCOL MOVE NOTIFY OPTIONS PATCH POST PROPFIND PROPPATCH PUT REPORT SEARCH SUBSCRIBE TRACE UNLOCK UNSUBSCRIBE are allowed on :

    //登录/样式

我做了一些搜索,实际上最终来到了这里。 disable HTTP methods, TRACK TRACE etc

解决方案

const allowedMethods = ['GET','HEAD','POST'];

function onrequest(req, res) {
  if (!allowedMethods.includes(req.method))
    return res.end(405, 'Method Not Allowed');
  // ...
}
Run Code Online (Sandbox Code Playgroud)

however i do not understand how to use the …

http http-method node.js

2
推荐指数
1
解决办法
4508
查看次数

标签 统计

http ×1

http-method ×1

node.js ×1