This repository has been archived by the owner. It is now read-only.

Can't access hosts offline #104

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

Comments

Projects
None yet
@meleyal

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

This comment has been minimized.

Show comment
Hide comment
@espen

espen commented Apr 27, 2011

+1

@Port3M5

This comment has been minimized.

Show comment
Hide comment
@Port3M5

Port3M5 Apr 27, 2011

I noticed this also.

Port3M5 commented Apr 27, 2011

I noticed this also.

@sstephenson

This comment has been minimized.

Show comment
Hide comment
@sstephenson

sstephenson Apr 27, 2011

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?

Contributor

sstephenson commented Apr 27, 2011

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

This comment has been minimized.

Show comment
Hide comment
@joren

joren commented May 3, 2011

+1

3 similar comments
@themgt

This comment has been minimized.

Show comment
Hide comment
@themgt

themgt commented May 3, 2011

+1

@baldrailers

This comment has been minimized.

Show comment
Hide comment
@baldrailers

baldrailers commented May 3, 2011

+1

@fd

This comment has been minimized.

Show comment
Hide comment
@fd

fd commented May 3, 2011

+1

@sstephenson

This comment has been minimized.

Show comment
Hide comment
@sstephenson

sstephenson May 3, 2011

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.

Contributor

sstephenson commented May 3, 2011

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

This comment has been minimized.

Show comment
Hide comment
@fd

fd May 3, 2011

workaround: Enable your Ad-Hoc Wifi Network.

fd commented May 3, 2011

workaround: Enable your Ad-Hoc Wifi Network.

@sstephenson

This comment has been minimized.

Show comment
Hide comment
@sstephenson

sstephenson May 3, 2011

Contributor

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

Contributor

sstephenson commented May 3, 2011

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

@sstephenson sstephenson closed this May 3, 2011

@fd

This comment has been minimized.

Show comment
Hide comment
@fd

fd May 3, 2011

sure.

fd commented May 3, 2011

sure.

@emilford

This comment has been minimized.

Show comment
Hide comment
@emilford

emilford Jun 23, 2011

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?

emilford commented Jun 23, 2011

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

This comment has been minimized.

Show comment
Hide comment
@raw1z

raw1z commented Jul 22, 2011

+1

@carlos

This comment has been minimized.

Show comment
Hide comment
@carlos

carlos Jul 26, 2011

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

carlos commented Jul 26, 2011

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

@marioizquierdo

This comment has been minimized.

Show comment
Hide comment
@marioizquierdo

marioizquierdo Jul 28, 2011

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

marioizquierdo commented Jul 28, 2011

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

@vallasd

This comment has been minimized.

Show comment
Hide comment
@vallasd

vallasd 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.

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

This comment has been minimized.

Show comment
Hide comment
@josephers

josephers Aug 24, 2011

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?

josephers commented Aug 24, 2011

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

This comment has been minimized.

Show comment
Hide comment
@lindblom

lindblom Aug 30, 2011

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 https://github.com/Rodreegez/powder/pull/41

lindblom commented Aug 30, 2011

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 https://github.com/Rodreegez/powder/pull/41

@smsm1

This comment has been minimized.

Show comment
Hide comment
@smsm1

smsm1 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.

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

This comment has been minimized.

Show comment
Hide comment
@guns

guns 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.

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

This comment has been minimized.

Show comment
Hide comment
@adamgotterer

adamgotterer Nov 30, 2012

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

adamgotterer commented Nov 30, 2012

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

@njvack

This comment has been minimized.

Show comment
Hide comment
@njvack

njvack 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 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

This comment has been minimized.

Show comment
Hide comment
@njvack

njvack 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.

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

This comment has been minimized.

Show comment
Hide comment
@guns

guns 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.

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

This comment has been minimized.

Show comment
Hide comment
@chrisberkhout

chrisberkhout Mar 14, 2013

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

chrisberkhout commented Mar 14, 2013

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

@xta

This comment has been minimized.

Show comment
Hide comment
@xta

xta Mar 27, 2013

+1 to gem install powder && powder host

also, using powder open works for me

xta commented Mar 27, 2013

+1 to gem install powder && powder host

also, using powder open works for me

@besi

This comment has been minimized.

Show comment
Hide comment
@besi

besi 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.

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.