How to find domain - express headers

Hi there!
I have tried using the host header, but it returns some url like I have tried the origin header, but it returns undefined. How can I find what domain the user is viewing the site from?

Maybe req.hostname?

Returns the hash.

OK. After a little bit more investigation, it seems the host parameter is not a hash when visiting from a project name, which is what I need really. It just doesn’t show the domain, which I actually don’t need.

This might be of some use:


That’s not part of express or Node.js. I need it on the backend. Anyway I figured out how to get what I needed :slight_smile: