Skip to content

Preserve URL path when proxy constructs database endpoint URLs#1761

Merged
kmcginnes merged 1 commit intoaws:mainfrom
kmcginnes:proxy-preserves-url-path
May 8, 2026
Merged

Preserve URL path when proxy constructs database endpoint URLs#1761
kmcginnes merged 1 commit intoaws:mainfrom
kmcginnes:proxy-preserves-url-path

Conversation

@kmcginnes
Copy link
Copy Markdown
Collaborator

Description

The proxy server used absolute paths in new URL() calls (e.g., new URL("/sparql", baseUrl)) which replaced the entire base URL path. This broke databases with non-root endpoints like BlazeGraph (/blazegraph/namespace/kb/sparql).

  • Extract resolveEndpointUrl helper that ensures a trailing slash on the base URL before resolving relative endpoint paths
  • Use a TypeScript template literal type constraint to prevent passing leading-slash paths at compile time
  • Add tests for path preservation across proxy endpoints, connection normalization, environment variable parsing, and IAM header preservation

Validation

  • All 1695 tests pass, all checks (lint, format, types) pass
  • End-to-end verified with finch compose: Graph Explorer proxy → BlazeGraph at /blazegraph/namespace/kb/sparql returns real SPARQL results
  • TypeScript enforces that resolveEndpointUrl rejects absolute paths ("/sparql" → compile error)

Related Issues

Check List

  • I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • I have verified pnpm checks passes with no errors.
  • I have verified pnpm test passes with no failures.
  • I have covered new added functionality with unit tests if necessary.
  • I have updated documentation if necessary.

The proxy server used absolute paths in new URL() calls which replaced
the entire base URL path. This broke databases with non-root endpoints
like BlazeGraph (/blazegraph/namespace/kb/sparql).

Extract resolveEndpointUrl helper that ensures a trailing slash on the
base URL before resolving relative endpoint paths. Add tests for path
preservation across proxy, client-side URL construction, connection
normalization, and environment variable parsing.

Fixes aws#1752
@kmcginnes kmcginnes marked this pull request as ready for review May 7, 2026 23:26
@kmcginnes kmcginnes merged commit 7ea8511 into aws:main May 8, 2026
3 checks passed
@kmcginnes kmcginnes deleted the proxy-preserves-url-path branch May 8, 2026 14:01
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.

Proxy server strips URL path from Graph Connection URL, breaking databases with non-root SPARQL endpoints

2 participants