# \[feature request\] middleware integration

**URL:** <https://discourse.nodered.org/t/feature-request-middleware-integration/37890>\
**Category:** Core Development\
**Created:** [22 December 2020 22:06 UTC](https://discourse.nodered.org/t/feature-request-middleware-integration/37890 "2020-12-22T22:06:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevinGodell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kevingodell/32/27040_2.png) [@kevinGodell](https://discourse.nodered.org/u/kevinGodell)\
**Post date:** [22 December 2020 22:06 UTC](https://discourse.nodered.org/t/feature-request-middleware-integration/37890/1 "2020-12-22T22:06:18Z")

</div>

I would like to add the feature that will allow the middleware(s) configured in **settings.js** for `httpAdminMiddleware` and `ui.middleware` to allow for an array of functions instead of just a single function.

This will make it easier to use various 3rd party middlewares, with a simple example being `cookie-parser`. This will allow for a middleware configuration as:

```auto
httpAdminMiddleware: [
  cookieParser('some_secret'),
  (req, res, next) => {
    // act upon the retrieved cookies
    if (req.signedCookies.mycookie === 'some_value') {
      return next();
    }

   next(new Error('access denied'));
]

```

If there are no objections, I will make the pull requests. It is a simple matter of adding  
`|| Array.isArray(middleware)`

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [22 December 2020 22:08 UTC](https://discourse.nodered.org/t/feature-request-middleware-integration/37890/2 "2020-12-22T22:08:36Z")

</div>

Hi @kevinGodell

seems reasonable. It would be good to update for `httpNodeMiddleware` as well - handled in `packages/node_modules/@node-red/nodes/core/network/21-httpin.js`

Please target the `dev` branch when you come to doing the PR - that's the new feature development for 1.3.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [20 February 2021 22:08 UTC](https://discourse.nodered.org/t/feature-request-middleware-integration/37890/3 "2021-02-20T22:08:42Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
