Skip to content

Commit

Permalink
wip test fjerning av cookie header
Browse files Browse the repository at this point in the history
  • Loading branch information
kenglxn committed Sep 29, 2023
1 parent a4d1a00 commit 176e72b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ const log = new Proxy(
}
);

const cookieScraperPlugin = (proxyServer, options) => {
proxyServer.on('proxyReq', (proxyReq, req, res, options) => {
delete proxyReq.header['cookie'];
});
};
// copy with mods from http-proxy-middleware https://github.com/chimurai/http-proxy-middleware/blob/master/src/plugins/default/logger-plugin.ts
const loggerPlugin = (proxyServer, options) => {
proxyServer.on('error', (err, req, res, target) => {
Expand Down Expand Up @@ -198,7 +203,13 @@ const main = async () => {
xfwd: true,
changeOrigin: true,
ejectPlugins: true,
plugins: [debugProxyErrorsPlugin, errorResponsePlugin, loggerPlugin, proxyEventsPlugin],
plugins: [
cookieScraperPlugin,
debugProxyErrorsPlugin,
errorResponsePlugin,
loggerPlugin,
proxyEventsPlugin,
],
};
app.use(
'/min-side-arbeidsgiver/tiltaksgjennomforing-api',
Expand Down

0 comments on commit 176e72b

Please sign in to comment.