Skip to content

Commit

Permalink
fix(react): fix proxy for login route (#3216)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe-lyons authored Sep 9, 2021
1 parent 940cbb1 commit f0c8f85
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion datahub-web-react/src/setupProxy.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
const logInFilter = function (pathname, req) {
return pathname.match('^/logIn') && req.method === 'POST';
};

if (process.env.REACT_APP_MOCK === 'true' || process.env.REACT_APP_MOCK === 'cy') {
// no proxy needed, MirageJS will intercept all http requests
module.exports = function () {};
Expand All @@ -8,7 +12,7 @@ if (process.env.REACT_APP_MOCK === 'true' || process.env.REACT_APP_MOCK === 'cy'
module.exports = function (app) {
app.use(
'/logIn',
createProxyMiddleware({
createProxyMiddleware(logInFilter, {
target: 'http://localhost:9002',
changeOrigin: true,
}),
Expand Down

0 comments on commit f0c8f85

Please sign in to comment.