Skip to content
This repository has been archived by the owner on May 15, 2020. It is now read-only.

Can't access hosts offline #104

Closed
meleyal opened this issue Apr 13, 2011 · 27 comments
Closed

Can't access hosts offline #104

meleyal opened this issue Apr 13, 2011 · 27 comments

Comments

@meleyal
Copy link

meleyal commented Apr 13, 2011

When offline I'm not able to access any Pow hosts through the browser.

I can ping them, or access them with lynx, but all the desktop browsers I've tried (FF, Chrome, Safari) are unable to resolve the host. I can only access them offline by manually adding them to /etc/hosts.

I guess this is down to DNS caching by the browser / OS, and is not really a Pow issue, but maybe someone can explain what's going on?

@espen
Copy link

espen commented Apr 27, 2011

+1

@Port3M5
Copy link

Port3M5 commented Apr 27, 2011

I noticed this also.

@sstephenson
Copy link
Contributor

It seems like the configuration in /etc/resolver is ignored when you're offline. Maybe someone would like to file a bug on Apple's Radar?

@joren
Copy link

joren commented May 3, 2011

+1

3 similar comments
@themgt
Copy link

themgt commented May 3, 2011

+1

@baldrailers
Copy link

+1

@fd
Copy link

fd commented May 3, 2011

+1

@sstephenson
Copy link
Contributor

Thanks for the support, guys, but I'm afraid any number of +1s isn't going to help fix this. It's an issue with OS X's resolver system.

@fd
Copy link

fd commented May 3, 2011

workaround: Enable your Ad-Hoc Wifi Network.

@sstephenson
Copy link
Contributor

Great find. @fd, could you add your workaround to the Troubleshooting wiki page?

@fd
Copy link

fd commented May 3, 2011

sure.

@emilford
Copy link

I am still trying to use Pow while offline. See here. I've tried the suggested fix of enabling the Ad-Hoc Network per the instructions on Apple linked to from the Troubleshooting section, but still no luck. Anything else I could be missing?

@raw1z
Copy link

raw1z commented Jul 22, 2011

+1

@carlos
Copy link

carlos commented Jul 26, 2011

I'm facing the same issue with Mac OS X Lion.

@marioizquierdo
Copy link

+1, before it worked to me, but just updated to Lion and now it doesn't work offline

@vallasd
Copy link

vallasd commented Aug 3, 2011

+1, doesn't work in Lion (offline) unless I update /etc/hosts to include 127.0.0.1 myapp.dev. Does anyone know of any issues that can happen by running pow this way?

I run all my projects in a specific directory: (not sure how many people do this)

/path/WebDevelopment/Project1
/path/WebDevelopment/Project2
/path/WebDevelopment/Project3, etc...

I am able to run multiple sites at the same time as long as they are in /etc/hosts...

Can't pow just run a little utility that checks an environment variable which is my WebDevelopment path, gets the directories in this path, checks them against /etc/hosts, and adds them to /etc/hosts if needed.

You could also get the links in the .pow directory auto updated this way as well.

@josephers
Copy link

So is the workaround in Lion now to add each .dev address to hosts? If so, what would happen if Pow just used hosts instead of resolver?

@lindblom
Copy link

I wrote a little piece of code today that solves the problem if you are using powder together with pow that is.

The pull request can be found at powder-rb/powder#41

@smsm1
Copy link

smsm1 commented Feb 1, 2012

The workaround of enabling the ad hoc wifi isn't a workaround when you are on a flight that prohibits wifi use. Hopefully the hosts option works. Powder adds extra dependancies that will clutter the bundle file for those who don't use it.

@guns
Copy link

guns commented Jul 18, 2012

Hello,

I was browsing the configd source trying to debug another problem, when
the solution to local DNS resolution while offline came to me:

http://serverfault.com/a/164215/3731

(See UPDATE section)

Essentially, if you specify the special root domain '.' as the domain
entry in your /etc/resolver/domain file, the resolver created is global,
and while it has lower precedence than the active network's DNS server
entry, it persists even when offline.

# cat /etc/resolver/root
nameserver 127.0.0.1
domain .

# scutil --dns # While offline
DNS configuration

resolver #1                     # EMPTY! This is the slot for active
                                # network resolver settings
resolver #2
  domain   : local
  options  : mdns
  timeout  : 5
  order    : 300000

...

resolver #8
  nameserver[0] : 127.0.0.1     # BINGO

It works on my machine, anyway. I thought I'd let you guys know here
since the serverfault poster linked to this issues page.

@adamgotterer
Copy link

Been a few months. Wanted to see if there were any new workarounds or break throughs?

@njvack
Copy link

njvack commented Feb 5, 2013

For what it's worth: guns's suggestion to add domain . to /etc/resolver/dev worked for me (osx 10.8.2). I think that if pow's installer does that, all will be well?

@njvack
Copy link

njvack commented Feb 7, 2013

OK, I'm actually a dumbass. Adding the "domain ." line actually sometimes seems to break regular DNS for me. So disregard my overly-hasty suggestion.

@guns
Copy link

guns commented Feb 7, 2013

I have since moved on to Linux as my desktop OS since I wrote that
serverfault post, but anyone who is really interested in solving this
can look at the sources for configd to figure out how the OS manages the
DNS resolvers stack:

http://www.opensource.apple.com/source/configd/

The solutions posted worked for me for 10.6 and 10.7 and allowed me to
continue to use dnsmasq as a local resolver even when not connected to a
network.

@chrisberkhout
Copy link

I had this problem too. I went with gem install powder && powder host solution.

@xta
Copy link

xta commented Mar 27, 2013

+1 to gem install powder && powder host

also, using powder open works for me

@besi
Copy link

besi commented Nov 20, 2014

This is based on @xta and @chrisberkhout's answers:
Since safari thinks you're offline you'll have to update your hosts file:

$ cat /etc/hosts
127.0.0.1   localhost
127.0.0.1   someproject.dev #powder
127.0.0.1   anotherproject.dev  #powder

The powder gem can take care of that by using the following command:

powder host            # Updates hosts file to map pow domains to 127.0.0.1

This fixed the problem for me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests