diff --git a/packages/code-studio/.env.development b/packages/code-studio/.env.development index 472169fbc2..430434dc0d 100644 --- a/packages/code-studio/.env.development +++ b/packages/code-studio/.env.development @@ -1,7 +1,8 @@ REACT_APP_ENABLE_LOG_PROXY=false -REACT_APP_CORE_API_URL=http://localhost:10000/jsapi -REACT_APP_NOTEBOOKS_URL=http://localhost:10000/notebooks -REACT_APP_LAYOUTS_URL=http://localhost:10000/layouts + +# Proxy set in src/setupProxy.js to handle CORS for other URLs +# https://create-react-app.dev/docs/proxying-api-requests-in-development/ + REACT_APP_ROUTER_BASE_NAME=/ REACT_APP_INTERNAL_PLUGINS=ExamplePlugin PORT=4000 diff --git a/packages/code-studio/package.json b/packages/code-studio/package.json index 9ff2f91cb3..9dd7dfa4d4 100644 --- a/packages/code-studio/package.json +++ b/packages/code-studio/package.json @@ -32,6 +32,7 @@ "cross-env": "^7.0.2", "deep-equal": "^2.0.4", "fira": "github:mozilla/fira#4.202", + "http-proxy-middleware": "^2.0.1", "jquery": "^3.5.1", "jszip": "3.2.2", "lodash.clamp": "^4.0.3", diff --git a/packages/code-studio/src/setupProxy.js b/packages/code-studio/src/setupProxy.js new file mode 100644 index 0000000000..5804bb6344 --- /dev/null +++ b/packages/code-studio/src/setupProxy.js @@ -0,0 +1,10 @@ +const { createProxyMiddleware } = require('http-proxy-middleware'); + +module.exports = app => { + app.use( + createProxyMiddleware({ + target: 'http://localhost:10000', + ws: true, + }) + ); +};