Skip to content

Fix clienturirewritefilter host#277

Merged
namedgraph merged 2 commits intodevelopfrom
fix-clienturirewritefilter-host
Mar 29, 2026
Merged

Fix clienturirewritefilter host#277
namedgraph merged 2 commits intodevelopfrom
fix-clienturirewritefilter-host

Conversation

@namedgraph
Copy link
Copy Markdown
Member

No description provided.

namedgraph and others added 2 commits March 29, 2026 23:26
When the request URI was a subdomain (e.g. admin.atomgraph.com) and
PROXY_HOST was set to the base domain (e.g. atomgraph.com), the filter
replaced the entire host with proxyHost, losing the subdomain. The HTTP
client then reused an existing SSL connection (SNI=atomgraph.com) for
the subdomain request, causing nginx to return 421 Misdirected Request
and breaking WebID agent loading in production.

Fix preserves the subdomain prefix when building the rewritten URI.
Adds unit tests covering exact host, subdomain, port, and query string cases.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The previous fix unconditionally prepended the subdomain prefix to
proxyHost, which broke dev setups using an internal proxy hostname
(e.g. PROXY_HOST=nginx): admin.localhost was rewritten to admin.nginx
instead of nginx, which doesn't resolve in Docker.

Only preserve the subdomain when proxyHost equals host (the production
case where both are the same domain). In that case the HTTP client would
otherwise reuse an existing connection with SNI=host for the subdomain
request, causing nginx to return 421 Misdirected Request.

Update test to reflect the correct behaviour for the internal-proxy case.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@namedgraph namedgraph merged commit d716cb3 into develop Mar 29, 2026
1 check passed
@namedgraph namedgraph deleted the fix-clienturirewritefilter-host branch March 29, 2026 22:10
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