Highlighted

Remote hostname

LEGEND ,
Apr 16, 2019

Copy link to clipboard

Copied

Hello, all,

I'm feeling kind of foolish for asking this, but I've been tasked by my boss.

We all know that in CF, one can access the remote hostname of the client system that is visiting a site/app.  If it's not immediately available, one can also do a reverse DNS lookup.  Even then, it's no guarantee that a valid value will be returned.

I think I already know the answer to this, but I need to make sure.

Is there a way to retrieve a client hostname in JavaScript?

(There, I said it.  I'm not proud.) 

V/r,

^ _ ^

Adobe Community Professional
Correct answer by Dave Watts | Adobe Community Professional

You should never feel foolish for asking anything! That's how I've learned almost everything I know.

To the best of my knowledge, that will not be available from within the browser by default. Javascript is sandboxed enough that it's not going to be able to ask the host OS for the hostname.

And even if it was, it wouldn't necessarily be a "canonical" value. Most desktop computers within a LAN aren't going to know their own real hostname, because they're sitting behind a firewall that does network address translation. So, for example, my desktop right now says its hostname is "DESKTOP-SQJ33T97" or something like that, because I'm working at home and I'm not doing anything to change internal network hostnames. But if I were connected to my office VPN, and went to your site, my IP address would be whatever the VPN assigned and the hostname would correspond to that address (home-gw.figleaf.com for example).

Dave Watts, Eidolon LLC

Views

420

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Remote hostname

LEGEND ,
Apr 16, 2019

Copy link to clipboard

Copied

Hello, all,

I'm feeling kind of foolish for asking this, but I've been tasked by my boss.

We all know that in CF, one can access the remote hostname of the client system that is visiting a site/app.  If it's not immediately available, one can also do a reverse DNS lookup.  Even then, it's no guarantee that a valid value will be returned.

I think I already know the answer to this, but I need to make sure.

Is there a way to retrieve a client hostname in JavaScript?

(There, I said it.  I'm not proud.) 

V/r,

^ _ ^

Adobe Community Professional
Correct answer by Dave Watts | Adobe Community Professional

You should never feel foolish for asking anything! That's how I've learned almost everything I know.

To the best of my knowledge, that will not be available from within the browser by default. Javascript is sandboxed enough that it's not going to be able to ask the host OS for the hostname.

And even if it was, it wouldn't necessarily be a "canonical" value. Most desktop computers within a LAN aren't going to know their own real hostname, because they're sitting behind a firewall that does network address translation. So, for example, my desktop right now says its hostname is "DESKTOP-SQJ33T97" or something like that, because I'm working at home and I'm not doing anything to change internal network hostnames. But if I were connected to my office VPN, and went to your site, my IP address would be whatever the VPN assigned and the hostname would correspond to that address (home-gw.figleaf.com for example).

Dave Watts, Eidolon LLC

Views

421

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Apr 16, 2019 0
Adobe Community Professional ,
Apr 16, 2019

Copy link to clipboard

Copied

You should never feel foolish for asking anything! That's how I've learned almost everything I know.

To the best of my knowledge, that will not be available from within the browser by default. Javascript is sandboxed enough that it's not going to be able to ask the host OS for the hostname.

And even if it was, it wouldn't necessarily be a "canonical" value. Most desktop computers within a LAN aren't going to know their own real hostname, because they're sitting behind a firewall that does network address translation. So, for example, my desktop right now says its hostname is "DESKTOP-SQJ33T97" or something like that, because I'm working at home and I'm not doing anything to change internal network hostnames. But if I were connected to my office VPN, and went to your site, my IP address would be whatever the VPN assigned and the hostname would correspond to that address (home-gw.figleaf.com for example).

Dave Watts, Eidolon LLC

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Apr 16, 2019 0
LEGEND ,
Apr 16, 2019

Copy link to clipboard

Copied

I kind of had a feeling that it wasn't possible, at least for security reasons if nothing else.  I'll let my boss know.  Thanks!

V/r,

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Apr 16, 2019 0