During local development the experience is hosted on https://localhost:3001 per the typical ExB installation and our backed API is hosted on https://localhost (or another domain). However, the Integration, Acceptance, and Production frontend and backend deployments are all deployed on the same domain, e.g., https://mydomain.com/myapp.
When calling our custom backend API we use known relative paths — e.g., fetch("api/weather") — as we prefer convention over configuration. However, this isn't workable as without a proxy the frontend sends requests to https://localhost:3001/api/weather rather than https://localhost/api/weather.
To support this in our custom non-ExB apps we utilize webpack-dev-server's proxy configuration. It appears the ExB Dev Edition uses Koa to serve the application. It would be very helpful it ExB Dev Edition supported the configuration of a local proxy similar to webpack-dev-server's proxy. A quick search shows that Koa has a proxy middleware (koa-proxy) that may be of use. Ideally, we could include a koa-proxy.js (or json) file to configure our proxy info.
This would make ExB Dev Edition more developer friendly; we would not need to code special logic for the dev only scenarios.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.