I have a system with three layers: two client web apps, one Backend, and two DBs.
The two DB and client app instances represent prod and test environments.
The backend has only one instance that should serve both environments. Say I have prod-client.myapp.com
, test-client.myapp.com
, prod-db.myapp.com
, and test-db.myapp.com
but only one API service api.myapp.com
.
The backend exposes one API, but it should match the client app and the DB environment. My current implementation is to send the environment code prod
or test
from the client app to the backend so it will know which DB to query.
Duplicating the backend for each environment is not an option.
But I'm wondering if sending the environment code from the client app is a good idea... Is there some security risk with that approach?
prod.myservice.com
be assumed to be meant for the prod db? Note: adding the code seems to create more headaches anyway (how do you handle the client sending the codeprod
to thetest.myservice.com
domain, and vice versa?)prod.myservice.com
... I have something likeapi.myservice.com
that serves BOTH environments. If I hadprod.myservice.com
andtest.myservice.com
everything was easy...