Skip to content

Commit

Permalink
test. Bare proxy - ikke bruk obo deokorator
Browse files Browse the repository at this point in the history
  • Loading branch information
eirikv committed Aug 7, 2024
1 parent 507a7a3 commit ac80a7e
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions server/src/proxy/decorator-intern-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,7 @@ const setup = (app: Express) => {
}),
);

app.use(
'/modiacontextholder/redirect/*',
proxy('https://modiacontextholder.intern.dev.nav.no', {
proxyReqOptDecorator: async (
options: RequestOptions,
req: Request<{}, any, any, ParsedQs, Record<string, any>>,
) => {
const accessToken = await requestOboToken(process.env.API_SCOPE!, req);
if (options?.headers) {
options.headers.Authorization = `Bearer ${accessToken}`;
let cookies = options.headers.cookie;
cookies = 'innlogget-part=VEILEDER; ' + cookies;
options.headers.cookie = cookies;
}
return options;
},
}),
);
app.use('/modiacontextholder/redirect/', proxy('https://modiacontextholder.intern.dev.nav.no'));

app.use('/internarbeidsflatedecorator', (req, res) => {
res.redirect(process.env.DECORATOR_INTERNAL + req.originalUrl);
Expand Down

0 comments on commit ac80a7e

Please sign in to comment.