question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot Secure Kue

See original GitHub issue

We used to secure Kue with something like this:

var app = express();
app.use(express.basicAuth(config.kue.username, config.kue.password));
app.use(kue.app);

var port = config.production ? 21 : 8002;
app.listen(port);

This no longer works and the browser just hangs trying to connect.

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
vicatcucommented, Nov 14, 2016

This project is great, thanks! In case it helps anyone I got this working on Ubuntu 16.04, with the following in my package.json dependencies.

    "basic-auth": "^1.0.4",
    "express": "^4.14.0",
    "kue": "^0.11.5"

Note: I have set this up with Nginx, set up with LetsEncrypt for SSL, as a reverse proxy port 3333. If you don’t ride it on an encryption layer (like SSL), Basic Auth is trivially insecure. I’m not going to try to address what it takes to set that up in this comment, but here are two useful pointers.

var kue = require('kue');
var basicAuth = require('basic-auth');
var express = require('express')
var app = express()

var auth = function (req, res, next) {
  function unauthorized(res) {
    res.set('WWW-Authenticate', 'Basic realm=Authorization Required');
    return res.send(401);
  };

  var user = basicAuth(req);

  if (!user || !user.name || !user.pass) {
    return unauthorized(res);
  };

  if (user.name === 'admin' && user.pass === 'password') {
    return next();
  } else {
    return unauthorized(res);
  };
};

app.use(auth);
app.use(kue.app);
app.set('title', 'My Application');
app.listen(3333);
0reactions
endoramacommented, Apr 25, 2015

By the way: npm package (8.1.2) does not require express 4, so my first comment is “wrong” 😃
My workaround and the link posted should work both for express 3 and 4 I think, as is only a simple middleware.
Maybe the problem reported by @digitaljohn is not related to express version as I first suggested?

Read more comments on GitHub >

github_iconTop Results From Across the Web

kue is crashing the server on Redis client error · Issue #240
When the Redis server causes an error (for example, disconnection or server is down), Kue is crashing the server (even that I'm handling...
Read more >
Cake – The most transparent way to get cashflow from your ...
The most transparent, safe and easy way to invest in DeFi and Web3. ... Get payouts as frequent as twice a day. Compare...
Read more >
kue - npm Package Health Analysis
We found a way for you to contribute to the project! Looks like kue is missing a security policy. You can connect your...
Read more >
Secure Cake Stacking - YouTube
In this video, Laura Barton at McArthur's Bakery shares a few helpful tips on how to securely stack tiered cakes for safe transportation....
Read more >
Carlo's Bakery - Nationwide Shipping & Local Pickup
Carlo's Bakery, as featured on TLC's Cake Boss, is known for our delicious pastries, desserts & cakes. Shop local or online—we ship ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found