Skip to content

Caddy listener_wrapper to automatically listen on an ngrok tunnel

License

Notifications You must be signed in to change notification settings

mohammed90/caddy-ngrok-listener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ngrok/Caddy Listener Wrapper

On March 9, 2023, ngrok announced the release of ngrok-go1, a Go package for embedding ngrok into a Go application. The package returns a net.Listener. This means it fits right into Caddy's listener_wrapper2. Using this module, when Caddy asks for a listener, it will ask ngrok for the listener, for which ngrok return an ngrok ingress address that is publicly accessible. The public address is printed in logs and avaible on ngrok dashboard.

Currently, the module does not support the extended ngrok options, e.g. allow/deny CIDR. PRs are welcome.

Example

Caddyfile

{
	servers :80 {
		listener_wrappers {
			ngrok {
				auth_token $NGROK_AUTH_TOKEN
				tunnel http {
				}
			}
		}
	}
}
:80 {
	root * /path/to/site/root
	file_server
}

Footnotes

  1. Alan Shreve's tweet

  2. listener_wrappers Caddyfile docs