ysbaddaden / prax

Rack proxy server for development
http://ysbaddaden.github.io/prax/
Other
475 stars 49 forks source link

Prax not working on ubuntu 14.04 LTS #87

Closed khanimdad closed 9 years ago

khanimdad commented 10 years ago

After setting it up by following the instruction from here https://github.com/ysbaddaden/prax when i hit http://trunk.dev, http://trunk.dev/, trunk.dev, or trunk.dev/ then it does not work in any case but results in search page from my ISP.

Any idea on how can i fix it?

karlwilbur commented 9 years ago

@khanimdad, Please post the output from:

curl -vi http://unicircles.dev/
zeitnot commented 9 years ago

@karlwilbur I have done already what have you said before but the result is same with @khanimdad's. I did run disable-dnsmasq.sh as well which you mentioned.

karlwilbur commented 9 years ago

@zeitnot, can you also do the steps I mentioned above and show me the output from your log file, as well as the output from the curl command above?

khanimdad commented 9 years ago

@karlwilbur , on "curl -vi http://unicircles.dev/" i get below... imdad@Youtoo:~/Hailisys/mymster/new$ curl -vi http://unicircles.dev/

ysbaddaden commented 9 years ago

127.0.53.53? There is something wrong. Either in prax nss resolver, or there is a DNS server resolving .dev domains to this weird IP. It should always resolve .dev to 127.0.0.1 and/or ::1.

Note: you may want to disable the nss extention, and configure dnsmasq to resolve .dev domains instead. It may prove better.

Note: I never had to disable the dnsmasq that Ubuntu installs and runs by default. I had problems with OpenDNS resolving unknown domains —but that can be configured.

khanimdad commented 9 years ago

@ysbaddaden , can you explain how can i solve this issue?

ysbaddaden commented 9 years ago

Depends where the problem comes. You may use getent hosts unicircles.dev on the command line, to verify what dev domains are being resolved to —don't use host and dig, they directly ask DNS servers and bypass NSSswitch. Actually, if host unicircles.dev resolves to something, your problem is a DNS server somewhere. Maybe dnsmasq, or /etc/hosts or the DNS of your Internet Provider or something else Ubuntu installed.

zeitnot commented 9 years ago

@karlwilbur

* Hostname was NOT found in DNS cache
*   Trying ::1...
* connect to ::1 port 80 failed: Connection refused
*   Trying 127.0.0.1...
* Connected to athena.dev (127.0.0.1) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.35.0
> Host: athena.dev
> Accept: */*
>

BTW, there is no any log under ~/.prax folder.

NomNomCameron commented 9 years ago

I seem to be having the same problem on Ubuntu 14.04, any request to http://myapp.dev doesn't make it to prax. Any word on this?

karlwilbur commented 9 years ago

@NomNomCameron,

Make sure you don't have another web server running (like Apache or Nginx).

Is iptables set up correctly?

sudo iptables -t nat -L -n

Is name resolution working for you?

ping -c 1 rapidreels.dev

What do you get from curl?

curl -vi http://myapp.dev/

Earlier tonight I was working with a developer who was getting Prax running for the first on their Ubuntu 14.04 machine. Chrome was caching the "No data received" page and refused to show anything else. Firefox, Chromium, Lynx, wget, and cURL all worked fine though. So, apparently Google Chrome has some caching issues.

NomNomCameron commented 9 years ago

I do have nginx installed but it isn't running

sudo iptables -t nat -L -n

Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination         
REDIRECT   tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:80 redir ports 20559
REDIRECT   tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:443 redir ports 20558

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
REDIRECT   tcp  --  0.0.0.0/0            127.0.0.1            tcp dpt:80 redir ports 20559
REDIRECT   tcp  --  0.0.0.0/0            127.0.0.1            tcp dpt:443 redir ports 20558

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination         

ping -c 1 myapp.dev

PING myapp.dev (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.023 ms

--- myapp.dev ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.023/0.023/0.023/0.000 ms

curl -vi http://myapp.dev

* Rebuilt URL to: myapp.dev/
* Hostname was NOT found in DNS cache
*   Trying ::1...
* connect to ::1 port 80 failed: Connection refused
*   Trying 127.0.0.1...
* Connected to myapp.dev (127.0.0.1) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.35.0
> Host: myapp.dev
> Accept: */*
> 
* Empty reply from server
* Connection #0 to host myapp.dev left intact
curl: (52) Empty reply from server
karlwilbur commented 9 years ago

@NomNomCameron,

All that looks good. Does your app start correctly with rails c? If so, does it work when you run rails s and connect on http://localhost:3000/?

If both of those are working, let's see the output of your logs. This will start monitoring new log entries:

tail -fn0 ~/.prax/_logs/{prax,myapp}.log

then run:

prax stop; prax start; curl -vi http://myapp.dev;

Then post what prax is saying.

ysbaddaden commented 9 years ago

Note that myapp.dev is a placeholder name. If your app is named foobar, access foobar.dev instaed, etc.

NomNomCameron commented 9 years ago

I wanted to uninstall prax and start from scratch, trying to use the uninstall script in libexec I get:

Stopping prax
./prax-uninstall: line 13: cd: /ext: No such file or directory
karlwilbur commented 9 years ago

@NomNomCameron, To uninstall you run:

prax uninstall

not:

/opt/prax/libexec/prax-uninstall

The uninstall command script (prax-uninstall) required some environmental setup done by command wrapper script prax.

Or you can do it manually:

prax stop;
sudo service prax stop;
sudo rm -rf /opt/prax /usr/local/bin/prax ~/.prax 
sudo sed -i -r -e '/\bprax\b//' /etc/nsswitch.conf
sudo update-rc.d prax remove

Then reinstall.

karlwilbur commented 9 years ago

FYI, I just ran into an issue with Prax+Chrome. Chrome is completely refusing to work correctly. All other browsers are working just fine. In trying to trouble shoot this, I came full-circle to back this thread. The post above (https://github.com/ysbaddaden/prax/issues/87#issuecomment-68762291 from @adamcrown) mentions an issue with Chrome's "Built-in Asynchronous DNS". I am not finding anything in chrome://flags about "Built-in Asynchronous DNS". So, while this seems to be the exact problem with Chrome, there doesn't seem to be a solution. This flag has been removed from Chrome and now there is no possibility of disabling it (https://chromium.googlesource.com/chromium/src/+/eabf1f5baba38d46921acd6edda594f942f7d6a1).

This is a Google Chrome issue. Google Chrome is broken (at least Version 41.0.2272.76 (64-bit)). Prax still works exactly as expected in Firefox, Lynx, cURL, Epiphay, Konqueror, or any other HTTP client that actually works.

ysbaddaden commented 9 years ago

Yes, async DNS is the problem in Chrome. I don't know why, unless they bypass NSSwitch altogether and hit DNS servers directly (WTH Google). There is still the "--disable-async-dns" flag for the time being, but that will eventually fail, too. I have no idea how we can fix that.

Could you move the discussion to it's own thread?

ysbaddaden commented 9 years ago

Closing since the thread went very far, and Prax is indeed working correctly on Ubuntu 14.04

dimonge commented 8 years ago

The thread messages were helpful. Thanks. @khanimdad