NetTalk Central

Author Topic: localhost not working, but 127.0.0.1 does  (Read 6255 times)

Wolfgang Orth

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
    • oData Wolfgang Orth
localhost not working, but 127.0.0.1 does
« on: June 23, 2018, 11:04:00 AM »
Hello Bruce and all,

with my newly tinkered webserver I ran into some problems.

1) Webserver > Settings > General
CSL has to hold something, at least an empty string '' - is that correct?
I fumble with an insecure server on my development machine, of course, so only port 80 is to be set.
I tried with both 80 and 443, but then I get this ugly message, that the server is not secure.
Port 80 is good during development.

2) I have set Insecure Port to 80, then compiled, but neither localhost nor http://localhost nor http://localhost:80 returns my index.htm.
However, 127.0.0.1 does.

Hmmm <headscratch>

All templates are the latest fashion, downloaded today.
Clarion 10.12211
NT 10.25
etc

Thanks
Wolfgang

Jane

  • Sr. Member
  • ****
  • Posts: 372
  • Expert on nothing with opinions on everything.
    • View Profile
    • Email
Re: localhost not working, but 127.0.0.1 does
« Reply #1 on: June 23, 2018, 12:50:05 PM »
Hi, Wolfgang,

What happens if you open a command prompt and PING localhost

Do you get a response from 127.0.0.1? 
(if you get a response from ::1: then try instead
ping localhost -4
to force IP V4. )

If you get an error instead, then read on...

Actually, I just learned something.

LOCALHOST used to be resolved in the HOSTS file.
But my HOSTS file now says "localhost name resolution is handled within DNS itself."

So I'd guess that somehow whatever you're using for DNS is not resolving it.

You can override that by using the HOSTS file to define localhost.

You'll probably find three lines in c:\windows\system32\drivers\etc\HOSTS
that look like
# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost

If you remove the # characters (which mark those lines as comments) from the second and third line shown, then your computer will use this file to resolve localhost instead of going to DNS, which doesn't seem to be working in your case.

HTH

Jane

Edit to add - if you want to edit hosts, you'll need to run notepad AsAdministrator
« Last Edit: June 23, 2018, 12:52:10 PM by Jane »

Wolfgang Orth

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
    • oData Wolfgang Orth
Re: localhost not working, but 127.0.0.1 does
« Reply #2 on: June 23, 2018, 11:05:28 PM »
ping localhost -4

Thank you for your response.

Yes, PING works okay, so do all my webserver on this machine, written with Nettalk 9. They all respond both on localhost and 127.0.0.1.

Its this new one, which acts strange.

I followed your advice, removed the # in the hosts-file, still no luck ... with FireFox. This FF insists on opening https://localhost/. However, trying Edge works okay. Hmmmmm, not sure whether I tried Edge last night too. Maybe its an odd behaviour of FF.

Anyway, I leave that hosts-file now in that modified state.

And I will now use 127.0.0.1.

PS-Addendum: I just learned that localhost works in FF also, when I use another port than 80.
« Last Edit: June 23, 2018, 11:15:20 PM by Wolfgang Orth »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: localhost not working, but 127.0.0.1 does
« Reply #3 on: June 25, 2018, 01:08:13 AM »
Hi Wolfgang,

>> 1) Webserver > Settings > General / CSL has to hold something, at least an empty string '' - is that correct?

no, not correct.

>> I fumble with an insecure server on my development machine, of course, so only port 80 is to be set.

if you only want insecure on port 80, then set the insecure port to 80, and the secure port to 0.

>> 2) I have set Insecure Port to 80, then compiled, but neither localhost nor http://localhost nor http://localhost:80 returns my index.htm. However, 127.0.0.1 does.

>> with FireFox. This FF insists on opening https://localhost/.

Your browser is remembering a permanent-redirect on that address. You can clear it out by clearing your browser history.
If you set up a secure site on an address, then the browser will try and change your URL to the secure address, even if you put in the insecure address. (Because the server, in the past, told it to.)

Cheers
Bruce




DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
Re: localhost not working, but 127.0.0.1 does
« Reply #4 on: July 01, 2018, 11:01:42 AM »
Wolfgang,

It sounds to me like you have the Settings control on your webserver window but perhaps the local settings variables have not been placed in the webserver local extension. 

The variables are something like set:InsecurePort, set:SecurePort, etc.  (going off of memory..)

Just my 2 cents.

Don
"Eliminate the impossible, whatever remains, however unlikely, must be the truth."

NetTalk 12.55
Clarion 11