caddy-tailscale
caddy-tailscale copied to clipboard
allow port to be configured with direct assignment
trafficstars
Closes: https://github.com/tailscale/caddy-tailscale/issues/84
Rational:
In some environments (like docker) it is desirable to expose the tailscale port to increase direct connection success. By default ts-net when encountering a 0 port will pick a port at random. This is difficult for docker since the ports are not known.
This work extends the node config to allow a node to gain a specific port, allowing for exposing in docker (or any other time where a user may wish to expose the port)
Steps to test:
-
Check out branch and run
xcaddy build --with github.com/tailscale/caddy-tailscale=$(pwd) -
Run the following caddyfile with
TS_AUTHKEYin environment
{
tailscale {
ephemeral
test-caddy {
port 41650
}
other-caddy {
port 41651
}
more-other-caddy {
port 41652
}
}
}
:80 {
bind tailscale/test-caddy
respond OK
}
:80 {
bind tailscale/other-caddy
respond OK
}
:80 {
bind tailscale/more-other-caddy
respond OK
}
- Verify port and that caddy serves correctly
curl http://test-caddy