1. Why share an environment #
Showing without deploying.
Use cases #
- Have a feature validated by a client or a product manager before deploying it.
- Debug together on the same environment.
- Test a webhook (payment, GitHub) that must call a public URL.
2. With ngrok #
The simplest and best-maintained solution.
Steps #
# Vagrantfile : publier le port 80 de la machine sur le port 8080 de l'hôte
# config.vm.network "forwarded_port", guest: 80, host: 8080
vagrant up
ngrok config add-authtoken <JETON> # compte ngrok requis
ngrok http 8080 # affiche l'URL publique https://…
ngrok http 8080 --basic-auth "demo:MotDePasse-Solide" # protéger l'accèsAlternatives #
| Tool | Specificity |
|---|---|
Cloudflare Tunnel (cloudflared) | Free, custom domain, access control |
| Tailscale Funnel | Exposure from a Tailscale network |
| Vagrant private network + VPN | Sharing without public exposure, between team members |
3. The vagrant-share plugin #
The historical approach.
Usage #
The vagrant-share plugin adds the vagrant share command that creates the tunnel for you. It relies on ngrok itself.
vagrant plugin install vagrant-share
vagrant share # partage HTTP de la machine
vagrant share --ssh # partage aussi l'accès SSH (à éviter)
vagrant connect --ssh <NOM> # côté collègueCommon mistake: vagrant-share is no longer actively maintained: prefer running ngrok or cloudflared directly.Security #
- Never share SSH publicly, or a machine containing real data.
- Protect the link (authentication) and close the tunnel as soon as the demo is over.
- A tunnel URL is public: anyone who knows it can access it.
Good practice: For long-term sharing, deploy a staging environment rather than exposing a development workstation.
