We are currently using Ember with multiple backends, and thus require multiple “proxies” – for example:
- any traffic to
/backend-one
needs to get proxied tohttp://serverone/somewhere/
- any traffic to
/backend-two
needs to get proxied tohttp://servertwo/somewhereelse/
Since ember server
only supports (as far as I know) a single --proxy ...
, we have (for better or worse) set this up by:
- Creating a
server/index.js
file - In this file, doing a
require('http-proxy').createProxyServer({})
and then anapp.use(...)
to enact the proxy for a given path. (Theproxy
/app.use
is done twice, one for each path.)
Now, this may be completely the wrong methodology, but it is how it currently works (and it seems to work fine).
Unfortunately, this causes us a bit of a problem for acceptance tests – we would like to have our acceptance tests access a ‘real’ backend, and thus they need to use the proxy. However, when we fire up ember test
, it does not seem to run the server/index.js
file, which means our proxies don’t run.
Can someone tell me “you are doing this completely wrong” and point me in the right direction?
(As an aside, we are currently using Ember 2.18 – I know, it’s old, but the upgrade hasn’t happened yet )
Thanks in advance!