Skip to content

Commit 57af904

Browse files
whummerclaude
andcommitted
Skip HTTP proxy in base class for TCP-only extensions
When all container ports are TCP-only and no host restriction is set, the base class now skips setting up the catch-all HTTP proxy that would intercept all requests. This moves the logic from ParadeDB's override into ProxiedDockerContainerExtension directly. Also temporarily rewrites localstack-extensions-utils dependencies to git+https for CI testing of the utils change across all extensions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f186d3e commit 57af904

File tree

5 files changed

+19
-26
lines changed

5 files changed

+19
-26
lines changed

paradedb/localstack_paradedb/extension.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
from localstack_extensions.utils.docker import ProxiedDockerContainerExtension
55
from localstack import config
6-
from localstack.extensions.api import http
76

87
# Environment variables for configuration
98
ENV_POSTGRES_USER = "PARADEDB_POSTGRES_USER"
@@ -57,23 +56,6 @@ def _tcp_health_check():
5756
tcp_ports=[postgres_port], # Enable TCP proxying through gateway
5857
)
5958

60-
# TODO: this should be migrated into the base class directly ..!
61-
def update_gateway_routes(self, router: http.Router[http.RouteHandler]):
62-
"""
63-
Override to set up only TCP routing without HTTP proxy.
64-
65-
ParadeDB uses the native PostgreSQL wire protocol (not HTTP), so we
66-
only need TCP protocol routing - not HTTP proxying. Adding an HTTP
67-
proxy without a host restriction would cause all HTTP requests to be
68-
forwarded to the PostgreSQL container, breaking other services.
69-
"""
70-
# Start the container
71-
self.start_container()
72-
73-
# Set up only TCP protocol routing (skip HTTP proxy from base class)
74-
if self.tcp_ports:
75-
self._setup_tcp_protocol_routing()
76-
7759
def tcp_connection_matcher(self, data: bytes) -> bool:
7860
"""
7961
Identify PostgreSQL/ParadeDB connections by protocol handshake.

paradedb/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ authors = [
1414
keywords = ["LocalStack", "ParadeDB", "PostgreSQL", "Search", "Analytics"]
1515
classifiers = []
1616
dependencies = [
17-
"localstack-extensions-utils"
17+
"localstack-extensions-utils @ git+https://github.com/localstack/localstack-extensions.git@fix/tcp-only-base-class#egg=localstack-extensions-utils&subdirectory=utils"
1818
]
1919

2020
[project.urls]

typedb/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ authors = [
1414
keywords = ["LocalStack", "TypeDB"]
1515
classifiers = []
1616
dependencies = [
17-
"localstack-extensions-utils"
17+
"localstack-extensions-utils @ git+https://github.com/localstack/localstack-extensions.git@fix/tcp-only-base-class#egg=localstack-extensions-utils&subdirectory=utils"
1818
]
1919

2020
[project.urls]

utils/localstack_extensions/utils/docker.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,22 @@ def update_gateway_routes(self, router: http.Router[http.RouteHandler]):
129129
)
130130
# note: for simplicity, starting the external container at startup - could be optimized over time ...
131131
self.start_container()
132-
# add resource for HTTP/1.1 requests
133-
resource = RuleAdapter(ProxyResource(self.container_host, self.main_port))
134-
if self.host:
135-
resource = WithHost(self.host, [resource])
136-
router.add(resource)
132+
133+
# Determine if HTTP proxy should be set up. Skip it when all container ports are
134+
# TCP-only and no host restriction is set, since a catch-all HTTP proxy would
135+
# intercept all requests and break other services.
136+
tcp_only = (
137+
self.tcp_ports
138+
and not self.host
139+
and set(self.container_ports) == set(self.tcp_ports)
140+
)
141+
142+
if not tcp_only:
143+
# add resource for HTTP/1.1 requests
144+
resource = RuleAdapter(ProxyResource(self.container_host, self.main_port))
145+
if self.host:
146+
resource = WithHost(self.host, [resource])
147+
router.add(resource)
137148

138149
# apply patches to serve HTTP/2 requests
139150
for port in self.http2_ports or []:

wiremock/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ keywords = ["LocalStack", "WireMock"]
1515
classifiers = []
1616
dependencies = [
1717
"priority",
18-
"localstack-extensions-utils"
18+
"localstack-extensions-utils @ git+https://github.com/localstack/localstack-extensions.git@fix/tcp-only-base-class#egg=localstack-extensions-utils&subdirectory=utils"
1919
]
2020

2121
[project.urls]

0 commit comments

Comments
 (0)