Isolating customer domain specific data using URI


apologies for the consecutive question…

** Customer Domain here is not actual Domain address but just customer’s company name

As I have multiple customers like customerdomain1/device1, customerdomain2/device2( devices assigned to each customers), I wanted to isolate the data using URI instead of having multiple realms (because, admin should see all users and devices regardless the customer domains)

I am planning to do this using a middleman (express.js).

Example - for getting list of devices

  • devices service (backend) registers myapp.devices.get

  • express.js registers .devices.get with wildcard match (notice the empty uri part).

  • browser will call customerdomain1.devices.get which will be matched by the procedure above.

  • The browser call will be caught by express.js then it will call myapp.devices.get in devices backend with filtering option of { domain: ‘customerdomain1’ }.

  • express.js will resolve the call customerdomain1.devices.get with the results.

so this whole thing becomes

Browser --customerdomain1.devices.get–> express.js

express.js --myapp.devices.get({domain: ‘customerdomain1’})–> devicesBackend

express.js --resolve customerdomain1.devices.get–> Browser

The reason for the roundtrip is for not filtering devices with payload but only using URI for absolute isolation.

I have a feeling that it creates a too much overhead and probably not a right way to achieve customer domain isolation.

Could anyone please shed a light here?

Thank you for reading and may the force be with you.