Skip to content

fix(proxy): Forward the query string in the agent relay - #650

Merged
balamurali27 merged 1 commit into
developfrom
fix/proxy-relay-query-string
Oct 25, 2026
Merged

balamurali27 merged 1 commit into
developfrom
fix/proxy-relay-query-string

Conversation

@balamurali27

Copy link
Copy Markdown
Contributor

The relay location on proxies (added in #412) builds proxy_pass from regex captures. With variables in proxy_pass, nginx sends only the URI built from them, so the query string is dropped. Press sends agent calls through this relay for every server with no public IP (about 1,000 app servers and 1,000 DB servers on prod).

Two agent routes read the query string, and both break through the proxy:

  • benches/<bench>/sites/<site>/info?database_only=1 (perf(site): Avoid file-tree walk when only database usage is needed #548): the flag never arrives, so the agent still walks all site files. On a big site this takes more than the 30 s Press timeout, and each timeout trips the agent request breaker for the whole server.
  • server/backup-jobs?site=...&start=...&end=...: fails with 400 "site is required" for these servers.

$is_args$args adds the query string back. A request with no query string is forwarded as before, with no stray ?.

I checked the same location shape in an nginx:1.27-alpine container. The old form forwards /agent/.../info?database_only=1 as /agent/.../info. The new form keeps ?database_only=1 and the full backup-jobs query, and forwards /agent/ping unchanged. nginx -t passes.

Rollout: the new config takes effect on a proxy only after its agent nginx config is written again and nginx is reloaded. A reload with a bad config fails and keeps the old config running.

🤖 Generated with Claude Code

The proxy location that relays `/<server>:<port>/agent/...` builds
`proxy_pass` from regex captures. With variables, nginx sends only the
URI built from them, so the query string was dropped for every server
that Press reaches through a proxy (servers with no public IP).

Two agent routes need it: site info `database_only`, so big sites
still did the full file walk, and `server/backup-jobs`, which failed
with 400 "site is required". `$is_args$args` adds it back, and a
request with no query string is forwarded as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mergify

mergify Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@greptile-apps

greptile-apps Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Reviews (1) · Last reviewed commit: "fix(proxy): Forward the query string in ..." · Reviewed by Greptile

@balamurali27
balamurali27 merged commit 4b65248 into develop Oct 25, 2026
6 checks passed
@balamurali27
balamurali27 deleted the fix/proxy-relay-query-string branch October 25, 2026 07:26
balamurali27 added a commit that referenced this pull request Oct 25, 2026
fix(proxy): Forward the query string in the agent relay (backport #650)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant