Fingertips / passengerpane

A Mac OS X preference pane for easily configuring Rails applications with Passenger.
http://www.fngtps.com/2008/06/putting-the-pane-back-into-deployment
Other
592 stars 42 forks source link

Safari 5.1 (on Lion) fails to load ".local" hosts #68

Open tvongaza opened 12 years ago

tvongaza commented 12 years ago

1) Built ppane from master with xcode 2) Setup a server with "ppain" called "app_name.local" with an alias of "app_name" 3) Can browse to "http://app_name.local" and "http://app_name" just fine with Chrome and Firefox 4) Can browse to "http://app_name" on Safari 5.1 5) Cannot browse to "http://app_name.local" on Safari 5.1

> ppane list
app_name.local
  Aliases:     app_name
  Folder:      /Users/tys/projects/app_name
  Environment: development
eric commented 12 years ago

I've ran into this as well.

agiletortoise commented 12 years ago

Ditto. Seems to be a Safari issue.

jonmagic commented 12 years ago

I'm seeing this issue as well, and I also tried downloading and using Webkit instead and it exhibits the same behavior. Chrome/Firefox work fine. Not cool.

agiletortoise commented 12 years ago

FYI, I've filed this issue with Apple, http://openradar.appspot.com/radar?id=1277407

jtippett commented 12 years ago

Also occurs with the application HTTP Client, which presumably uses the same mechanism as Safari to do the lookup.

tadman commented 12 years ago

I've had a look at how pow performs lookups of .dev addresses and it appears to register a custom resolver with OS X in /etc/resolvers. The source-code references the resolver man page.

A typical install produces /etc/resolver/dev:

# Lovingly generated by Pow
nameserver 127.0.0.1
port 20560

A portion of the pow installer is a name server written in JavaScript which handles these requests. The process that handles these requests is auto-started via .plist file registered with launchctl.

Manfred commented 12 years ago

I just pushed a fix to the master branch that fixes the problem for me. ppane now writes your application's hosts to /etc/hosts. It only does this on Lion. Please let me know if this fixes it for you.

agiletortoise commented 12 years ago

Thanks!

Works great for me.

cforcey commented 12 years ago

Thanks for this fix. I am still having trouble reaching .local hosts. Here is what I did: git pulled the latest master to my local passenger pane repository. Confirmed that the latest git log entries showed the Lion fix. Ran the build command and got a new, working passengerpane in the build folder. Uninstalled my existing one. Quit System Settings. Installed my new one by double clicking. Restarted (multiple times in the end). Tried to reach the local directory through Safari -- still no go. Deleted and recreated the site -- no go. No changes evident in my etc/hosts file. Curious! Would love to have this back and appreciate you taking your time on something that Safari seems to have broken from the pack to mess up. Cheers and thank you for spending time on this really useful tool -- your generosity saves us all a ton of time setting up development instances and it is appreciated! Charles

Manfred commented 12 years ago

Charles, can you open /etc/hosts on your system and check if the sites you've configured ended up in there?

cforcey commented 12 years ago

Thanks so much for the reply. Sadly, no, my hosts file has remained unchanged through several rounds of delete a site in the pref pane, add it again, etc. Here is the current text and every thing on the bottom is added by hand to get the sites working:


Host Database

#

localhost is used to configure the loopback interface

when the system is booting. Do not change this entry.

127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost fe80::1%lo0 localhost

development workarounds

127.0.0.1 yaddo.dev 127.0.0.1 mesolore.dev


I looked closely at the source code before compiling and saw where you look for Lion (10.7) and write the hosts. But no joy for me. I have gotten the latest on the git repository and rebuilt a couiple of times, always removing the previous one and checking that I have a new binary, but the lion behavior is still not triggered. I am wondering if somehow my build process is off? Or some permissions issue is holding me back:

-rw-r--r-- 1 root wheel 501 Sep 2 07:16 /etc/hosts

Thanks so much for your help! C


Charles Forcey 12 Thompson Lane Durham, NH 03824 p. 603-868-9900 c. 603-781-1189 f: 800-403-0463 www.historicusinc.com cforcey@historicusinc.com

On Sep 9, 2011, at 4:36 PM, Manfred Stienstra wrote:

Charles, can you open /etc/hosts on your system and check if the sites you've configured ended up in there?

Reply to this email directly or view it on GitHub: https://github.com/Fingertips/passengerpane/issues/68#issuecomment-2055491

Manfred commented 12 years ago

Does ~/Library/PreferencePanes/Passenger.prefPane/Contents/Resources/lib/passenger_pane/directory_services.rb or /Library/PreferencePanes/Passenger.prefPane/Contents/Resources/lib/passenger_pane/directory_services.rb include workaround code? If not you, please remove the passenger pane and reinstall.

The workaround copies the entries from the directory services into you hosts file, so also make sure your hosts are listed when running:

$ /usr/bin/dscl localhost -list /Local/Default/Hosts

If they're not listed there I'm not sure what's wrong (:

cforcey commented 12 years ago

Here are the contents of that directory_services.rb

module PassengerPane
  class DirectoryServices
    def self.registered_hosts
      `/usr/bin/dscl localhost -list /Local/Default/Hosts`.split("\n")
    end

    def self.register(hosts)
      hosts.each do |host|
        system(trust("/usr/bin/dscl localhost -create /Local/Default/Hosts/#{host} IPAddress 127.0.0.1"))
      end
    end

    def self.unregister(hosts)
      hosts.each do |host|
        system(trust("/usr/bin/dscl localhost -delete /Local/Default/Hosts/#{host}"))
      end
    end
  end
end

Looks like I have to delete and reinstall it! Will trouble shoot some more -- thanks! Checking the git checkout I have, the right code is in the lib directory (checking for 10.7) but not in the package that I created from the code. So I will try to familiarize myself with the build process and figure out why the new library is not being tucked in there. That part is new for me! Thanks again for taking your time to help!

PS: Hosts all show up fine when I do: /usr/bin/dscl localhost -list /Local/Default/Hosts

SOLUTION! I needed to delete the contents of my release directory for xcodebuild to overwrite the binary with the new package. Once I did that, I could confirm the new code was in the new package and I was good to go. On my first edit, /etc/hosts was modified to include all my preference pane hosts. Thanks so much! Knowing where to look in the package for the updated code was the key to debugging my installation.