using ssh, caddy, and the cloud provider of your choice - spin up 1 virtual machine to proxy all your local services without exposing your external gateway.
- host locally without forwarding ports on external gateway.
- no ddns
- no port forwarding
- mask your public IP address
- available without manual intervention
I started this project trying to find an alternative to proxy hosting services like ngrok. Say you have a webserver running locally on port 8080. For external machines to access this we need a simple way to view the web service. Using a cloud VPC (Virtual Machine running in the Cloud [AWS, Azure, Digital Ocean, etc...]) we can use this public IP address instead of our public IP address.
- Start Service on local server
- Enable systemd service to handle tunnel
- logon to remote server
- edit /etc/caddy/Caddyfile
- add a reverse proxy to your desired url and the local port forwarded.
[Unit]
Description=ssh tunnel to proxy server
[Service]
User=root
Environment=SSH_AUTH_SOCK=/run/user/1000/ssh-agent.socket
ExecStart=/usr/bin/ssh -o ServerAliveInterval=60 -i /home/$USER/.ssh/id_rsa -NT -R $service_port:localhost:$service_port root@$remote_host
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
test.example.com {
reverse_proxy 127.0.0.1:$service_port
}
Mirror of selfhost repository