• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Remote hostname

LEGEND ,
Apr 16, 2019 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,

^ _ ^

Views

530

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
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 16, 2019 Apr 16, 2019

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

...

Votes

Translate

Translate
Community Expert ,
Apr 16, 2019 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

Votes

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
community guidelines
LEGEND ,
Apr 16, 2019 Apr 16, 2019

Copy link to clipboard

Copied

LATEST

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,

^ _ ^

Votes

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
community guidelines
Resources
Documentation