I'm trying to use basic auth to login to my grafana page using Node.js and express, but it shows me an error like below.
The 'localhost:4000' is holding my app.js and 'localhost:5000' is from nginx that proxy_pass to my grafana page(localhost:8080)
Here is my basic auth code
app.get('/grafana', isLoggedIn, function(req, res, next){
console.log('Accessing to grafana');
var auth = "Basic " + new Buffer('admin' + ":" + 'admin').toString("base64");
request({
url: 'http://localhost:5000',
headers:{
"Authorization": auth
} //passing through here
}, function(err, resp, body){
what is my problem here..? I added the Access-Control-Allow-Origin and etc like below, but doesn't work at all..
app.all('*', function(req, res, next) {
res.header('Access-Control-Allow-Origin', "*");
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
res.header('Access-Control-Allow-Headers', 'Origin, Basic, X-Requested-With, Content-Type, Accept, Authorization');
res.header('Access-Control-Allow-Credentials', 'true');
next();
});
Does anybody have an idea for this...?
Thank you..