Rack proxy server for development
This is an (almost) complete rewrite of Prax
in Crystal, a Ruby-inspired language that compiles
down to LLVM. This version should avoid problems with version managers, since Prax
is now a binary application that don't rely on Ruby anymore (except for Rack and
Please refer to the wiki for more information:
How it works
*.testdomains to 127.0.0.1 / ::1 (localhost)
- redirects the :80 and :443 ports to :20559 and :20558
- receives incoming HTTP requests and extracts the hostname (eg: myapp.test)
- spawns a Rack applications (found at
~/.prax/myapp) if any
- proxies the request to the spawned Rack aplication or to the specified port.
Prax proposes 2 solutions to resolve
- a dnsmasq configuration, either throught NetworkManager or by installing dnsmasq manually (eg. through your Linux distribution package);
- an obsolete and deprecated NSSwitch extension, only compatible wih glibc and no longer compatible with Google Chrome/Chromium, and certainly more;
Prax also supports http://xip.io domains, so you may use
myapp.184.108.40.206.xip.io for example. This is very useful when using an
external device like a smartphone or tablet or another computer.
If your computer runs systemd, it's possible a service such as
systemd-resolved or something else systemd took over,
is conflicting with a local resolver. I don't have a solution —except to stay
as far away as possible from systemd as possible.
.test domains are not your cup of tea, no problem! Prax will route
requests from any TLD to the applications in your
~/.prax directory, as long
as the domain resolves to localhost.
For instance, if you wished to visit "myapp.dev" instead of "myapp.test", you could create dnsmasq configuration to resolve ".dev" domains to localhost, too:
sudo tee /etc/dnsmasq.d/dev <<EOF local=/dev/ address=/dev/127.0.0.1 address=/dev/::1 EOF sudo service dnsmasq restart
The port redirections are iptables rules, that are installed and removed using
an initd script. The script redirects the port :80 and :443 on 127.0.0.1 and for
ethX devices found on your machine, to allow incoming
traffic, so you may use xip.io to test on external devices, as mentioned above.
In Chrome, if one types "myapp.test" into the URL bar, Chrome will issue a search. Type "http://myapp.test" or "myapp.test/" instead to visit that URL.
Prax is distributed under the CeCILL 2.1 license. Please see LICENSE for details.
- Julien Portalier email@example.com
Prax wouldn't exist without Pow!! by Sam Stephenson and Basecamp. Prax is nothing more but a reimplementation (in another language) with Linux compatibility in mind.