Skip to content

Commit

Permalink
replace ACAO instead of stripping it
Browse files Browse the repository at this point in the history
  • Loading branch information
zburke committed Aug 22, 2024
1 parent 20158b7 commit 03efbce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/commands/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function serveCommand(argv) {

if (argv.startProxy) {
console.info('starting proxy');
childProcess.fork(path.resolve(context.cliRoot, './lib/run-proxy.js'), [argv.okapi, argv.proxyPort]);
childProcess.fork(path.resolve(context.cliRoot, './lib/run-proxy.js'), [argv.okapi, argv.proxyPort, argv.port]);
// if we're using a proxy server - we need to pass the proxy host as okapi to Stripes platform
replaceArgvOkapiWithProxyURL(argv);
}
Expand Down
7 changes: 4 additions & 3 deletions lib/run-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ const { createProxyMiddleware } = require('http-proxy-middleware');
const app = express();

const OKAPI = process.argv[2];
const PORT = process.argv[3];
const PROXY_PORT = process.argv[3];
const PORT = process.argv[4];

app.use(
'/',
Expand All @@ -13,10 +14,10 @@ app.use(
changeOrigin: true,
on: {
proxyRes: (proxyRes) => {
delete proxyRes.headers['Access-Control-Allow-Origin'];
proxyRes.headers['Access-Control-Allow-Origin'] = `http://localhost:${PORT}`;
},
},
}),
);

app.listen(PORT);
app.listen(PROXY_PORT);

0 comments on commit 03efbce

Please sign in to comment.