Skip to content

Commit

Permalink
Add Origin for oidc requests
Browse files Browse the repository at this point in the history
  • Loading branch information
skadefro committed Jun 23, 2022
1 parent becf3a0 commit 4fd0be7
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions OpenFlow/src/WebServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,6 @@ export class WebServer {

// Add headers
this.app.use(function (req, res, next) {

// Grafana hack
if (req.originalUrl == "/oidc/me" && req.method == "OPTIONS") {
return res.send("ok");
}
if (req.originalUrl.indexOf('/oidc') > -1) return next();
Logger.instanse.verbose('WebServer', 'setCORSHeaders', "add for " + req.originalUrl);
// const origin: string = (req.headers.origin as any);
// if (NoderedUtil.IsNullEmpty(origin)) {
Expand All @@ -121,6 +115,18 @@ export class WebServer {
res.header('Expires', '-1');
res.header('Pragma', 'no-cache');

if (req.originalUrl == "/me") {
res.redirect('/oidc/me')
return next();
}

// Grafana hack
if (req.originalUrl == "/oidc/me" && req.method == "OPTIONS") {
return res.send("ok");
}
if (req.originalUrl.indexOf('/oidc') > -1) return next();


// Pass to next layer of middleware
next();
});
Expand Down

0 comments on commit 4fd0be7

Please sign in to comment.