Skip to content

Commit c513c40

Browse files
committed
Document domain matching patterns supported by nginx map directive
1 parent 50f23af commit c513c40

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,24 @@ Starts the buildcage builder container.
203203
| `buildcage_image` | No | `ghcr.io/<owner>/<repo>` | Docker image name |
204204
| `buildcage_version` | No | `1` | Image tag |
205205
| `proxy_mode` | No | `restrict` | Operation mode (`audit` / `restrict`) |
206-
| `allowed_http_domains` | No | empty | Allowed HTTP domains (comma-separated, without port) |
207-
| `allowed_https_domains` | No | empty | Allowed HTTPS domains (comma-separated, without port) |
206+
| `allowed_http_domains` | No | empty | Allowed HTTP domains (comma-separated, without port). See [Domain matching patterns](#domain-matching-patterns) below |
207+
| `allowed_https_domains` | No | empty | Allowed HTTPS domains (comma-separated, without port). See [Domain matching patterns](#domain-matching-patterns) below |
208208
| `http_ports` | No | `80` | Comma-separated HTTP listen ports for the proxy |
209209
| `https_ports` | No | `443` | Comma-separated HTTPS listen ports for the proxy |
210210
| `port` | No | `1234` | BuildKit endpoint port on localhost |
211211

212+
##### Domain matching patterns
213+
214+
Domain values use nginx's [`map`](https://nginx.org/en/docs/http/ngx_http_map_module.html) directive with the `hostnames` parameter, supporting several patterns:
215+
216+
| Pattern | Example | Matches |
217+
|---------|---------|---------|
218+
| Exact domain | `registry.npmjs.org` | Only `registry.npmjs.org` |
219+
| Prefix wildcard | `*.example.com` | `sub.example.com`, `deep.sub.example.com` (not `example.com` itself) |
220+
| Dot-prefix shorthand | `.example.com` | Both `example.com` and `*.example.com` |
221+
| Suffix wildcard | `example.*` | `example.com`, `example.io`, `example.org`, etc. |
222+
| Regex | `~^.*\.amazonaws\.com$` | Full PCRE regex (prefix with `~`) |
223+
212224
#### Outputs
213225

214226
| Name | Description |
@@ -248,7 +260,6 @@ Pass this port to [`docker/setup-buildx-action`](https://github.com/docker/setup
248260
#### Tips
249261

250262
- Start with audit mode to discover required domains, then switch to restrict mode.
251-
- Wildcard domains are supported (e.g., `*.github.com` matches all subdomains of `github.com`).
252263
- Separate HTTP and HTTPS domains — some services use different hosts for each protocol.
253264
- Common package registries often use multiple domains (e.g., PyPI uses both `pypi.org` and `files.pythonhosted.org`).
254265
- Some package managers download over plain HTTP (e.g., certain Debian mirrors). Add those domains to `allowed_http_domains` separately:
@@ -451,10 +462,6 @@ A: Yes. Just add your private registry's domain to `allowed_https_domains`.
451462
452463
A: In restrict mode, the build will fail with a clear error message. Run in audit mode first to discover all required domains.
453464
454-
**Q: Can I use wildcards in domain names?**
455-
456-
A: Yes. Prefix wildcards like `*.example.com` are supported and will match all subdomains (e.g., `sub.example.com`, `deep.sub.example.com`). Note that `*.example.com` does not match `example.com` itself—add both if needed. Suffix wildcards (e.g., `example.*`) are not supported.
457-
458465
**Q: Do I need to clean up the buildcage container?**
459466
460467
A: No. The container is automatically removed when the GitHub Actions job completes.

0 commit comments

Comments
 (0)