pgrok: the author tells you to buy the tool it replaces
Poor man's ngrok - a multi-tenant HTTP/TCP reverse tunnel solution through SSH remote port forwarding
At a glance
- What is it?
- pgrok is a self-hosted reverse tunnel that gives every user a stable subdomain behind your own single sign-on, built on SSH remote port forwarding. Its README is unusually honest about when not to use it, and its deployment files are unusually careful, which is about where the tension sits.
- Who is it for?
- pgrok suits a small team that wants stable per-person tunnel URLs and single sign-on, already has a domain and an identity provider, and can run a server and a database. Four things to weigh before you deploy it.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 2 days ago.
- What is it written in?
- Mainly Go, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 25, 2026, and from our analysis. They are not legal advice.
Star history
- pgrok/pgrok3,651 ★ · +2
| Repository | 2026-09-24 | 2026-11-25 |
|---|---|---|
| pgrok/pgrok | 3.6k | 3.7k |
2 Stars in the last 62 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
The README tells you not to use it in production, and to buy the alternative
The positioning paragraph is the most valuable thing on the page. The project describes itself as a bare-bones alternative to a named commercial product's per-user enterprise tier, quoting a price of sixty five dollars per user per month and adding a parenthetical that the pricing has changed since the project was founded. Then two sentences that almost no competing tool includes: trying to put this behind a production system will break your service level agreement, and for individuals and production systems the author says to buy the commercial tool, calling it their favourite. That is a maintainer telling you the limits of their own work in the first screen rather than after you have migrated onto it. It also frames what follows accurately: this is infrastructure for exposing development environments to a small trusted team, gated by an identity provider you operate.
Copy, paste and run, behind four prerequisites and two DNS records
The stated design goal is that copying, pasting and running is the best experience for everyone, and the argument for it is a good one: not everyone who needs a tunnel is a developer who understands server operations, and for community managers, sales staff and product managers, being asked to fix server problems wastes the team's time. Then the prerequisites list arrives with four items: a domain name, a server with a public IP, a single sign-on provider that will issue an OpenID Connect client, and a PostgreSQL server, with three hosted options and self-hosting named. The server setup adds two DNS records, an apex and a wildcard, a note about setting them to DNS only if the DNS provider proxies, one of three install methods, a network policy change to accept SSH traffic from anywhere, Caddy with a supplied configuration file, and an identity provider client whose redirect URI you must get exactly right. That is a lot to copy and paste, and the goal and the procedure are in visible tension.
The client looks for its configuration in two different default places
The token is where a tunnel tool keeps its identity, so the token's file location is worth tracing. The initialisation step says the configuration file is created under the standard user configuration directory, and gives the three platform paths for it: an application support directory on macOS, a dot config directory on Linux, and a local application data directory on Windows. Then the launch step says the client expects that file either under the standard user configuration directory or under a dot-prefixed directory in your home. So there are two accepted default locations, only one of which the initialisation step writes to, and a second one that is mentioned only in passing when launching. Both steps do agree on the escape hatch, a configuration flag to point somewhere else. The practical effect is small but real: a client started in an environment with a different home directory, or one configured with the second location by hand, will not find what the first command created.
The example hostname is misspelled three times, including in the log line
Every worked example on the page spells the sample subdomain with the letters transposed, and one of those places is the line you are told to look for. After initialisation the page says you should see a log that reads as a party emoji followed by a readiness message containing the example host with the transposition, and the remote address you configured. So if you are grepping your startup output to confirm the tunnel came up, the string you are matching contains a typo. It appears again in the subdomain prefix section, where the deterministic-URL example produces a host built on the same misspelled label, and the prefix documentation refers to that same label. None of this breaks anything, since the label is arbitrary, but it is the kind of copy-and-paste artefact that survives for years, and it is a useful signal about how much proofreading the deployment steps have had.
Three ports published with no bind address, and a database with no health check
The compose file is the deployment path most people will copy, and it has three choices worth reading. First, it publishes three ports with no bind address, so all three listen on every interface of the host: the administrative port, the HTTP port and the SSH port that carries the tunnel itself. The page describes all of this as being on your own machine. Second, the database service has no health check and the daemon service has no readiness condition on it, only a plain ordering dependency, while the daemon is set to restart always, which means a first boot that starts before the database is accepting connections will be retried rather than reported. Third, the database image is unpinned, so it resolves to whatever the current tag is, while the daemon image uses the latest tag as well. The one genuinely careful file in this project is the container build; the compose file is the loose one.
The container build pins base images by digest, then installs from a rolling channel
The container build is the most carefully written file in the repository and it is worth knowing what it does. All three base images are pinned by digest rather than by tag: a Node image for the frontend build, a Go toolchain image for the binary, and an Alpine image for the runtime. The frontend is built with the package manager in frozen lockfile mode, twice over, and the resulting static assets are copied into the Go source tree so the finished binary embeds the web interface rather than serving files from disk. The binary is compiled with path trimming, a production build tag, and three values injected at link time: a version that defaults to the word unknown if the build does not pass one, the commit hash, and a build timestamp. The runtime stage creates an unprivileged user, uses an init process as the entry point, and defines a health check. All of that is careful work. The same runtime stage then appends two package repository lines for the development edge channel before installing anything, and installs four packages from it: certificate authorities, an init process, and two libraries expressed as minimum versions rather than exact ones, with curl and a compression library carrying explicit floors. So the build pins three base images immutably by digest and then installs its runtime libraries from a channel that changes daily, and specifies those two libraries loosely enough that a rebuild can pick up a newer release. The floors are a reasonable middle ground for a security-relevant library, but they are a middle ground: the image is not the same twice. If you run this in production, export the image and pin by digest rather than rebuilding, because that is the only way the care taken in the first half of this file actually pays off.
The identity dependency is a CoreOS library still on its incompatible version
The module manifest opens with a Go language version of 1.26.3 and then a dependency list where two entries deserve attention. The OpenID Connect implementation is the CoreOS library, and it is pinned with a build tag that marks the version as incompatible with its own module path, which is how Go says a release predates modules and will not be upgraded by the tooling. It is the authentication layer for the whole project, since gating each user's subdomain behind your identity provider is the feature the README leads with. The second entry is a module on the author's own vanity domain, pinned by a date-stamped pseudo-version, so part of this system lives outside this repository. Around them sit a web framework with its session handling, two separate JSON web token libraries, a JWT library, an ORM with a Postgres driver, a UUID generator, a concurrency library, a process runner, and a terminal styling stack.
TCP tunnels open five thousand ports and hand out semi-stable ones
The raw TCP mode is the part with the sharpest operational edges, and the page does flag it. Before you can use it you must widen your network policy to accept inbound traffic across a port range of ten thousand to fifteen thousand, from anywhere. After that, each tunnel is assigned a port on the server, and the page's word for that assignment is semi-stable: the same number is reused when it is still available, which means it is not promised. For a database tunnel or anything else a client connects to by number, a port that moves when someone else is already on it is a category of failure that HTTP tunnels do not have, because an HTTP tunnel is addressed by a subdomain instead. The success line for a TCP tunnel shows the assigned address, so you can read it at startup, which is the mitigation. The three configuration values that can be overridden on the command line are the remote address, the forward address and the token. The HTTP mode has one feature the TCP mode lacks, and it is the reason some people prefer this to a generic tunneler: a single tunnel can route by path prefix, so a frontend on one local port and a backend that gRPC callers need to reach directly on another can share one public address.
dynamic_forwards: |
/api http://localhost:8080
/hook http://localhost:8080Everything unprefixed still goes to the configured forward address, which is how the example keeps its frontend on one port and sends two path prefixes to the backend on another.
Editorial conclusion
pgrok suits a small team that wants stable per-person tunnel URLs and single sign-on, already has a domain and an identity provider, and can run a server and a database. Four things to weigh before you deploy it. The author explicitly says not to put it behind a production system and recommends buying the commercial alternative instead, so take that at face value. The tunnel mechanism means opening an SSH port to the world, and raw TCP tunnels additionally need a five thousand port range open. The compose file publishes the admin port, the tunnel port and the SSH port on every interface, which is not what you want on a shared network. And the identity provider dependency is a CoreOS OpenID Connect library still on its old incompatible major version, which is worth a look before it fronts your staff.
Frequently asked questions
Is there a free alternative to ngrok?
This repository is one, and it is free in the sense that it is MIT licensed and self-hosted, not free of prerequisites. It gives every user a stable subdomain and gates access behind an OpenID Connect provider you run, which the README names as the two things too expensive to buy. You need a domain, a server with a public IP, an identity provider that will issue OIDC clients, and a PostgreSQL server. The author also states plainly that for individuals and for production use you should buy the commercial tool instead.
How does pgrok work?
Through remote port forwarding from the SSH protocol. You run a small client on the machine whose development environment you want exposed; it opens an SSH connection to your server, which assigns the user a stable subdomain on your domain and routes requests for it to whatever local address you configured. Requests to your server arrive over plain HTTP by default in the examples, are proxied by Caddy, and are authenticated against your identity provider before the tunnel is used.
How do I install the pgrok client?
With a Homebrew formula or by downloading the archive from the releases page. Then initialise a configuration file with the remote server address, the local address to forward to and your token, and launch the client. The configuration lands in the platform's standard user configuration directory by default, a flag overrides the path, and a debug flag turns on verbose logging. Successful startup prints a readiness line containing the URL you can visit and the remote address.
Can pgrok forward to more than one local address?
For HTTP, yes. The configuration accepts a block of path prefix rules mapping paths to addresses, so requests beginning with one prefix go to one local service and everything else goes to the default forward address. The worked case is a frontend on one port with a backend that gRPC endpoints need to reach directly on another. For TCP there is no such mapping; each tunnel forwards a single local port, and the server-side port it lands on is described as semi-stable, so the same number is reused while it is free.
What ports does pgrok need open?
One port for the SSH connection that carries every tunnel, which the instructions tell you to accept from anywhere. The compose file publishes three ports with no bind address, so they listen on every interface of the host: the administrative port, the HTTP port and the SSH port. If you also want raw TCP tunnels you must accept a range of five thousand ports from anywhere as well, which the page flags as an important step before that feature will work.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/pgrok-pgrok)Star history chart for your README
[](https://hysenlabs.com/projects/pgrok-pgrok)Was this useful?