Skip to content

fix(proxy): use project.name for proxy hostname when set#2128

Open
jlaneve wants to merge 1 commit into
mainfrom
proxy-project-name
Open

fix(proxy): use project.name for proxy hostname when set#2128
jlaneve wants to merge 1 commit into
mainfrom
proxy-project-name

Conversation

@jlaneve
Copy link
Copy Markdown
Contributor

@jlaneve jlaneve commented May 7, 2026

Summary

  • standalone and docker proxy modes derived the <x>.localhost hostname purely from the project directory name, which meant subdir layouts (e.g. airflow/) ended up at airflow.localhost regardless of project identity
  • the astro dev proxy help text already advertises <project>.localhost, so this aligns behavior with documentation
  • DeriveHostname now takes projectName (from .astro/config.yaml's project.name) and prefers it over the directory name when set; in worktrees, projectName replaces the repo segment while the per-worktree segment is preserved so URLs stay distinct across multiple worktrees of the same project

Behavior change

project.name layout before after
unset ~/foo/ foo.localhost foo.localhost (unchanged)
circus ~/circus/airflow/ airflow.localhost circus.localhost
circus worktree at wt/feat-x/ of repo circus feat-x.circus.localhost (was repo-derived) feat-x.circus.localhost (now project.name-derived; same shape)

existing users with project.name == dirname see no change. existing users with project.name != dirname get the documented <project>.localhost behavior, which may differ from what they had cached. worth a release note

API note

pkg/proxy.DeriveHostname and airflow/proxy.DeriveHostname gain a leading projectName string parameter. these are exported but used internally by the CLI; any external Go importers would need to update call sites

Test plan

  • go test ./pkg/proxy/... passes (existing tests + 5 new cases for project name behavior)
  • go test ./airflow/... passes (delegate test updated)
  • go build ./... clean
  • end-to-end verified: built binary, ran astro dev start in circus/airflow/ (project.name=circus), URL went from http://airflow.localhost:6563 to http://circus.localhost:6563, served HTTP 200

standalone and docker proxy modes derived the `<x>.localhost` hostname
purely from the project's directory name, which meant subdir layouts
(e.g. `airflow/`) ended up at `airflow.localhost` regardless of project
identity. the `astro dev proxy` help text already advertises
`<project>.localhost`, so this aligns behavior with documentation.

`DeriveHostname` now takes `projectName` (read from `.astro/config.yaml`'s
`project.name`) and prefers it over the directory name when set. in
worktrees, `projectName` replaces the repo segment but the per-worktree
segment is preserved so URLs stay distinct across multiple worktrees of
the same project.

verified end-to-end against a repo where `airflow/` is a subdir and
project.name is "circus": URL changed from `airflow.localhost:6563` to
`circus.localhost:6563`

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jlaneve jlaneve requested a review from a team as a code owner May 7, 2026 13:48
@coveralls-official
Copy link
Copy Markdown

Coverage Report for CI Build 0

Coverage remained the same at 39.746%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: 6 of 6 lines across 3 files are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 65899
Covered Lines: 26192
Line Coverage: 39.75%
Coverage Strength: 9.4 hits per line

💛 - Coveralls

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.

1 participant