Skip to content

feat(proxy): support wildcard subdomain#426

Merged
jdx merged 2 commits into
jdx:mainfrom
gaojunran:feat-proxy-wildcard
May 6, 2026
Merged

feat(proxy): support wildcard subdomain#426
jdx merged 2 commits into
jdx:mainfrom
gaojunran:feat-proxy-wildcard

Conversation

@gaojunran

Copy link
Copy Markdown
Contributor

No description provided.

@greptile-apps

greptile-apps Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds wildcard subdomain matching to the pitchfork proxy, so requests for tenant.myapp.localhost automatically fall back to the myapp slug when no exact slug is registered for that subdomain. The feature is opt-out (enabled by default via proxy.wildcard = true) and covers auto-start page display, schema, settings documentation, and unit tests.

  • wildcard_slug_lookup progressively strips dot-separated prefixes from left to right using match_indices, finding the first registered slug suffix; exact matches always take priority.
  • try_auto_start call site is updated to pass cached.slug instead of the full subdomain, so the "Starting…" page displays the canonical slug name rather than the tenant-prefixed hostname.
  • mise.lock adds -baseline platform variants for all managed tools; this is an unrelated toolchain update bundled in the same PR.

Confidence Score: 4/5

The core proxy logic change is small and well-tested; the main surface to watch is wildcard-on-by-default for existing deployments.

The wildcard lookup algorithm, the auto-start slug fix, and the settings wiring all look correct. Test coverage is solid across exact, subdomain, nested, disabled, and priority-ordering cases. The one thing worth a second look: wildcard is enabled by default, which means existing deployments that register short or generic slugs (e.g. api, app) will start matching arbitrary subdomains of those slugs after upgrading without any config change. Whether that is intentional is documented, but operators should be aware when rolling this out.

src/proxy/server.rs — specifically the default-on behavior of proxy.wildcard and whether it could inadvertently route unexpected hostnames in existing deployments.

Important Files Changed

Filename Overview
src/proxy/server.rs Adds wildcard subdomain matching via wildcard_slug_lookup, new slug field on CachedSlugEntry, and corrects try_auto_start to use the registered slug name. Tests cover exact, subdomain, nested, disabled, and priority cases.
settings.toml Adds the proxy.wildcard Bool setting with default = "true" and an env var override. Documentation and type annotations look correct.
docs/public/schema.json Adds nullable boolean wildcard field to the proxy schema, consistent with the null-tolerant pattern used for other proxy settings.
docs/guides/port-management.md Documents the new wildcard subdomain feature, per-TLD behavior table, and dnsmasq setup instructions. Content is accurate.
mise.lock Adds -baseline platform variants (same checksums as the non-baseline entries) for all tools; routine lockfile update.

Reviews (1): Last reviewed commit: "[autofix.ci] apply automated fixes" | Re-trigger Greptile

@gaojunran gaojunran marked this pull request as ready for review May 6, 2026 11:13
@gaojunran

gaojunran commented May 6, 2026

Copy link
Copy Markdown
Contributor Author

src/proxy/server.rs — specifically the default-on behavior of proxy.wildcard and whether it could inadvertently route unexpected hostnames in existing deployments.

I guess this will not affect the existing behaviour. Opening by default is an improvement

@jdx jdx merged commit 5127185 into jdx:main May 6, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants