Skip to content

Commit

Permalink
test. createProxyMiddelware
Browse files Browse the repository at this point in the history
  • Loading branch information
eirikv committed Aug 8, 2024
1 parent 608ae45 commit 4b56bc4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions server/src/proxy/decorator-intern-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,20 @@ const setup = (app: Express) => {
const accessToken = await requestOboToken(process.env.MODIACONTEXTHOLDER_API_SCOPE, req);
req.headers['Authorization'] = `Bearer ${accessToken}`;
req.headers['cookie'] = 'innlogget-part=VEILEDER; ' + req.headers['cookie'];
console.log('req', req);
next();
},
createProxyMiddleware({
target: process.env.MODIACONTEXTHOLDER_URL + '/modiacontextholder/redirect',
target: process.env.MODIACONTEXTHOLDER_URL,
followRedirects: false,
changeOrigin: true,
on: {
proxyReq: (proxyReq, req) => {
console.log('request', req.url, req.headers);
},
proxyRes: (proxyRes, req, res) => {
console.log('response', proxyRes.statusCode);
},
},
}),
);

Expand Down

0 comments on commit 4b56bc4

Please sign in to comment.