Skip to content

Latest commit

 

History

History
32 lines (25 loc) · 1.12 KB

README.md

File metadata and controls

32 lines (25 loc) · 1.12 KB

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