2017-11-17 2 views
1

Ich bin mit den GUI-Builder Schuhe und ich erhalte die unten Fehlermeldung, wenn ich eine einfache HTTP-Anforderung an meinem lokalen Rails ServerSchuhe Rb Hostname nicht bekannt: sub.localhost: 3000

Also, wenn ich den Antrag stellen machen

res = Net::HTTP.get(URI.parse("http://sub.localhost:3000")) 

ich den Fehler:

Hostname not known: sub.localhost 
/Applications/Shoes.app/Contents/MacOS/lib/ruby/2.2.0/resolv-replace.rb:12:in `rescue in getaddress' 
/Applications/Shoes.app/Contents/MacOS/lib/ruby/2.2.0/resolv-replace.rb:9:in `getaddress' 
/Applications/Shoes.app/Contents/MacOS/lib/ruby/2.2.0/resolv-replace.rb:23:in `initialize' 
/Applications/Shoes.app/Contents/MacOS/lib/ruby/2.2.0/net/http.rb:879:in `open' 
/Applications/Shoes.app/Contents/MacOS/lib/ruby/2.2.0/net/http.rb:879:in `block in connect' 
/Applications/Shoes.app/Contents/MacOS/lib/ruby/2.2.0/timeout.rb:73:in `timeout' 
/Applications/Shoes.app/Contents/MacOS/lib/ruby/2.2.0/net/http.rb:878:in `connect' 
/Applications/Shoes.app/Contents/MacOS/lib/ruby/2.2.0/net/http.rb:863:in `do_start' 
/Applications/Shoes.app/Contents/MacOS/lib/ruby/2.2.0/net/http.rb:852:in `start' 
/Applications/Shoes.app/Contents/MacOS/lib/ruby/2.2.0/net/http.rb:1375:in `request' 
shoes.rb:24:in `request' 
shoes.rb:63:in `block (3 levels) in <main>' 
-e:1:in `call' 
/Applications/Shoes.app/Contents/MacOS/lib/ruby/2.2.0/resolv-replace.rb:12:in `rescue in getaddress' 
/Applications/Shoes.app/Contents/MacOS/lib/ruby/2.2.0/resolv-replace.rb:9:in `getaddress' 
/Applications/Shoes.app/Contents/MacOS/lib/ruby/2.2.0/resolv-replace.rb:23:in `initialize' 
/Applications/Shoes.app/Contents/MacOS/lib/ruby/2.2.0/net/http.rb:879:in `open' 
/Applications/Shoes.app/Contents/MacOS/lib/ruby/2.2.0/net/http.rb:879:in `block in connect' 
/Applications/Shoes.app/Contents/MacOS/lib/ruby/2.2.0/timeout.rb:73:in `timeout' 
/Applications/Shoes.app/Contents/MacOS/lib/ruby/2.2.0/net/http.rb:878:in `connect' 
/Applications/Shoes.app/Contents/MacOS/lib/ruby/2.2.0/net/http.rb:863:in `do_start' 
/Applications/Shoes.app/Contents/MacOS/lib/ruby/2.2.0/net/http.rb:852:in `start' 
/Applications/Shoes.app/Contents/MacOS/lib/ruby/2.2.0/net/http.rb:1375:in `request' 
shoes.rb:24:in `request' 
shoes.rb:63:in `block (3 levels) in <main>' 
-e:1:in `call' 

Meine hosts-Datei hat 127.0.0.1 sub.localhost und ich kann die Adresse und machen Anfragen dagegen kein Problem, nur nicht in die Schuhe Projekt erreichen.

Ich folgte this Rat Frage und banden meine lokale IP-Adresse ex 123.12.12.1, sondern erhalten den gleichen Fehler Hostname not known: sub.123.12.12.1

This sagte die Linie resolv-replace.rb:9:in im Schuhe Projekt zu entfernen, aber ich habe den gleichen Fehler Hostname not known: sub.123.12.12.1

ich bin auf einem Mac

+0

Ich habe das gesehen ... – SoEzPz

Antwort

1

Verwenden Sie ein custom DNS resolver, um sicherzustellen, dass Ruby in der hosts Datei aussieht:

Jetzt verwendet Net::HTTP Ihren benutzerdefinierten Resolver, der zuerst hosts überprüft und erfolgreich Ihre benutzerdefinierten Domänen auflösen.

+0

Das ist perfekt. Ich wünschte, du wärst früher hier, aber ich habe für 'ngrok' bezahlt, um es zur Arbeit zu bringen. Ha. – teddybear