NodeJS web application login to grafana via AuthProxy

Hi, I am building an application based around docker multi containers. I would like to have my node applications login also login the user to their grafana dashboard. I have attempted implementing auth proxy but failed. I can see my grafana.ini settings working as they get passed from the docker compose file. The ini is below.

Summary

[users]

allow_sign_up = false

auto_assign_org = true

auto_assign_org_role = Editor

[auth.basic]

enabled = false

[auth]

disable_login_form = true

[auth.proxy]

enabled = true

header_name = X-WEBAUTH-USER

header_property = username

auto_sign_up = true

[server]

protocol = http

http_addr =

http_port = 3000

domain = localhost

enforce_domain = false

root_url = %(protocol)s://%(domain)s:%(http_port)s/

serve_from_sub_path = true

I am trying to use express-http-proxy or http-proxy to complete this but I don’t seem to be doing it correctly. I am not sure how to get the users set up, they can even just all log into the same viewer user. Im just not sure what I else to do as there are very few examples on how to achieve this. The example in the documentation use an Apache server is that necessary in my case?

My node app is running on 8080 and the code I recently have tried it below. Does anyone have any suggestions?

Summary

var proxy = require(‘express-http-proxy’);

var app = express();

app.use(’/grafana’, proxy(‘community.grafana.com’, {

proxyReqOptDecorator: function(proxyReqOpts, req) {

// you can update headers

const bodyData = JSON.stringify(req.body);

proxyReqOpts.headers['Content-Type'] = 'application/json';

proxyReqOpts.headers['Content-Length'] = Buffer.byteLength(bodyData);

proxyReqOpts.headers['X-WEBAUTH-USER'] = 'test';

// you can change the method

return proxyReqOpts;

},

proxyErrorHandler: function(err, res, next) {

switch (err && err.code) {

  case 'ECONNRESET':    { return res.status(405).send('504 became 405'); }

  case 'ECONNREFUSED':  { return res.status(200).send('gotcher back'); }

  default:              { next(err); }

}

}}));