Monday 23 December 2019

Identifying the host domain from req.hostname

I have two environments for my project - UAT and PROD. The rest apis are available in api.company.com and api2.company.com respectively.For a particular implementation need, I need to know these domain names to differentiate between the environments instead of using the node env variable. I tried using the req.hostname and req['host']. They all return 127.0.0.1Is there any way to get the original domain from the req object?Thanks in advance.

Submitted December 24, 2019 at 05:35AM by donttalkaboutpoland

No comments:

Post a Comment