Running rails server
will start a local server that you can access via http://localhost:3000
.
When you are working on multiple web apps, they will likely set cookies with generic names on localhost
. This is annoying, since you will sign out your current user whenever you switch to another app.
A better way is to use our own daho.im service. All daho.im subdomains resolve to your local IP (127.0.0.1). That means you can use a different hostname for different apps, and you will stay logged in in each app:
http://foo-app.daho.im:3000 => 127.0.0.1
http://bar-app.daho.im:3000 => 127.0.0.1
http://bam-app.daho.im:3000 => 127.0.0.1
Caution
It's safe to use
daho.im
since it's our own domain. Don't use external services likevcap.me
because we can't guarantee someone doesn't change DNS. Also do not hard-code the domain into 100 different config settings. Instead, define it in a single place so switching it out will be easy.
bash alias to generate link per project
In practice it is helpful to have a bash alias to generate the vcap.me link for you. This way it is also ensured that you always get the same link for a project. Have the following line in your .bashrc
:
alias dahoim='echo "http://$(basename $PWD).daho.im:3000"'
From a project directory (e.g. foo-app
) this command will print the link to console that you can click on (ctrl + click
):
~/foo-app $ dahoim
http://foo-app.daho.im:3000
You can also use the following to directly open a browser with the URL:
alias dahoim-open='nohup xdg-open "http://$(basename $PWD).daho.im:3000" > /dev/null 2>&1'
IPv6 support
The default records use IPv4 only. Use these records if you need IPv6 support.
# IPv6 only
$ q foo.v6.daho.im
foo.v6.daho.im. 1h0m0s AAAA ::1
# IPv4 and IPv6
$ q foo.v4v6.daho.im
foo.v4v6.daho.im. 1h0m0s AAAA ::1
foo.v4v6.daho.im. 1h0m0s A 127.0.0.1
FRITZ!Box issues
Check Wildcard hostnames for development (daho.im, vcap.me) do not resolve with FRITZ!Box as DNS resolver if your FRITZ!Box does not resolve this domain.