ysbaddaden / prax

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

Nothing in Iptables on Ubuntu 13.04 #52

Closed wyaeld closed 10 years ago

wyaeld commented 10 years ago

I've tried getting this to work on my machine, and not having any luck getting it to work. No errors or issues came up.

However running sudo iptables --list shows nothing. My expectation is that I would see prax's rules to redirect the :80 and :433 to its own ports.

running http://myapp.dev/ fails to resolve in either Chrome or FF.

Any ideas where I'm going wrong?

terlar commented 10 years ago

This command doesn't output all the tables, the rules are stored in the nat table, what about: sudo iptables -L -t nat

wyaeld commented 10 years ago
$ sudo iptables -t nat -L -n -v

Chain PREROUTING (policy ACCEPT 107K packets, 21M bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 DOCKER     all  --  *      *       0.0.0.0/0            0.0.0.0/0            ADDRTYPE match dst-type LOCAL
    0     0 REDIRECT   tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:80 redir ports 20559
    0     0 REDIRECT   tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:443 redir ports 20558

Chain INPUT (policy ACCEPT 41482 packets, 8013K bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 37798 packets, 2352K bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 DOCKER     all  --  *      *       0.0.0.0/0           !127.0.0.0/8          ADDRTYPE match dst-type LOCAL
    0     0 REDIRECT   tcp  --  *      *       0.0.0.0/0            127.0.0.1            tcp dpt:80 redir ports 20559
    1    60 REDIRECT   tcp  --  *      *       0.0.0.0/0            127.0.0.1            tcp dpt:443 redir ports 20558

Chain POSTROUTING (policy ACCEPT 16047 packets, 996K bytes)
 pkts bytes target     prot opt in     out     source               destination         
   33  2583 MASQUERADE  all  --  *      *       10.0.3.0/24         !10.0.3.0/24         
21745 1355K MASQUERADE  all  --  *      *       172.17.0.0/16       !172.17.0.0/16       

Chain DOCKER (2 references)
 pkts bytes target     prot opt in     out     source               destination

Does this look correct? I can see what looks like the expected redirects, but again Prax doesn't work. It could be corporate network proxies getting in the way, but I moved prax up in the resolve.conf to before dns and it didn't change anything

ysbaddaden commented 10 years ago

Dumb questions:

$ cd path/to/myapp
$ prax log -f
wyaeld commented 10 years ago
$ bin/prax start
Starting prax in the background.

$ bin/prax log
I, [2013-11-04T11:43:19.727820 #17133]  INFO -- : HTTP server ready on port 20559
I, [2013-11-04T11:43:19.728167 #17133]  INFO -- : HTTPS server ready on port 20558
I, [2013-11-04T11:53:07.198241 #18120]  INFO -- : HTTP server ready on port 20559
I, [2013-11-04T11:53:07.198481 #18120]  INFO -- : HTTPS server ready on port 20558
I, [2013-11-04T12:59:20.970611 #5969]  INFO -- : HTTP server ready on port 20559
I, [2013-11-04T12:59:20.970928 #5969]  INFO -- : HTTPS server ready on port 20558

$ getent hosts
127.0.0.1       localhost
127.0.1.1       brad-datacom
127.0.0.1       ip6-localhost ip6-loopback

$ getent hosts doc_genie.dev
::1             doc_genie.dev

$ bin/prax list
doc_genie  ~/rails_projects/doc_genie
docgenie   ~/rails_projects/doc_genie

does that help?

ysbaddaden commented 10 years ago

I meant to check that getent is capable to resolve .dev domains to localhost, for instance:

$ getent hosts docgenie.dev
::1             docgenie.dev

You may start Prax in debug mode, then use cURL in another terminal to check:

$ PRAX_DEBUG=1 prax start --foreground
D, [2013-11-06T14:30:08.571769 #19682] DEBUG -- : Starting HTTP server on port 20559
I, [2013-11-06T14:30:08.572168 #19682]  INFO -- : HTTP server ready on port 20559
I, [2013-11-06T14:30:16.271132 #19682]  INFO -- : Starting app docgenie (path/to/doc_genie)
curl -vv http://docgenie.dev/
[... expected HTML ...]

You may also want to check your app's log (maybe there was an error starting your app):

$ cd ~/rails_projects/doc_genie/
$ prax log
[... log of doc_genie app ...]

The log is also in ~/.prax/_logs/doc_genie.log

ysbaddaden commented 10 years ago

Closing for no activity.