Skip to content

Commit

Permalink
DT-6631 fix hsl login
Browse files Browse the repository at this point in the history
  • Loading branch information
sharhio committed Dec 17, 2024
1 parent 5435ee8 commit 01d6043
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions src/setupProxy.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
/* eslint-disable */
const { createProxyMiddleware } = require('http-proxy-middleware');

const setLocalhostCookies = proxyRes => {
if (
process.env.NODE_ENV === 'development' &&
proxyRes.headers.location === 'http://localhost:3000/' &&
proxyRes.headers['set-cookie'] !== undefined
) {
const cookies = proxyRes.headers['set-cookie'].map(
// get browser to set cookie for testing
cookie => cookie.replace('SameSite=None', 'SameSite=Strict; Secure'),
);
proxyRes.headers["set-cookie"] = cookies;
}
};

module.exports = function (app) {
app.use(
'/oid_callback',
createProxyMiddleware({
target: 'http://localhost:3001',
changeOrigin: true,
onProxyRes: function (proxyRes) {
setLocalhostCookies(proxyRes);
},
}),
);
app.use(
Expand All @@ -15,15 +32,7 @@ module.exports = function (app) {
target: 'http://localhost:3001',
changeOrigin: true,
onProxyRes: function (proxyRes) {
if (process.env.NODE_ENV === "development" &&
proxyRes.headers.location === "http://localhost:3000/" &&
proxyRes.headers["set-cookie"] !== undefined) {
const cookies = proxyRes.headers["set-cookie"].map(
// get browser to set cookie for testing
(cookie) => cookie.replace("SameSite=None", "SameSite=Strict; Secure")
);
proxyRes.headers["set-cookie"] = cookies;
}
setLocalhostCookies(proxyRes);
},
}),
);
Expand Down

0 comments on commit 01d6043

Please sign in to comment.