ysbaddaden / prax.cr

Rack proxy server for development (Crystal port)
Other
152 stars 18 forks source link

Ensures a rack application started by prax is accessible through 127.0.0.1 even on IPV6 systems #83

Closed devlucas closed 5 years ago

devlucas commented 5 years ago

Previously to this commit, the underlying command used to start a rack application was something like this:

$HOME/.rvm/gems/<ruby version>/bin/rackup --host localhost --port <port>

The issue is that on systems with IPV6 enabled by default like on Fedora 29, the OS will be responsible to translate localhost into its actual IP address, which will be ::1, leaving the application accessible on localhost:<port> but not on 127.0.0.1:<port>, as it is expected to be in order to check if it is connectable yet here:

https://github.com/ysbaddaden/prax.cr/blob/78a7926b29159e930406b23d2cea75bcbc86a0d6/src/prax/application.cr#L66

Given the above TCP connection will never succeed, prax will eventually error saying the application startup timed out.

This commit simply ensures that the rack application is started at the exact host it will be queried on later for readiness.

ysbaddaden commented 5 years ago

Thx!