Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/src/api/lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ async def proxy_sandbox_endpoint_request(request: Request, sandbox_id: str, port
and asynchronously proxies the request to it.
"""

endpoint = sandbox_service.get_endpoint(sandbox_id, port)
endpoint = sandbox_service.get_endpoint(sandbox_id, port, resolve_internal=True)

target_host = endpoint.endpoint
query_string = request.url.query
Expand Down
11 changes: 6 additions & 5 deletions server/tests/test_routes_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ def test_proxy_forwards_filtered_headers_and_query(
) -> None:
class StubService:
@staticmethod
def get_endpoint(sandbox_id: str, port: int) -> Endpoint:
def get_endpoint(sandbox_id: str, port: int, resolve_internal: bool = False) -> Endpoint:
assert sandbox_id == "sbx-123"
assert port == 44772
assert resolve_internal is True
return Endpoint(endpoint="10.57.1.91:40109")

monkeypatch.setattr(lifecycle, "sandbox_service", StubService())
Expand Down Expand Up @@ -116,7 +117,7 @@ def test_proxy_rejects_websocket_upgrade(
) -> None:
class StubService:
@staticmethod
def get_endpoint(sandbox_id: str, port: int) -> Endpoint:
def get_endpoint(sandbox_id: str, port: int, resolve_internal: bool = False) -> Endpoint:
return Endpoint(endpoint="10.57.1.91:40109")

monkeypatch.setattr(lifecycle, "sandbox_service", StubService())
Expand All @@ -138,7 +139,7 @@ def test_proxy_rejects_websocket_upgrade_for_post_and_mixed_case_header(
) -> None:
class StubService:
@staticmethod
def get_endpoint(sandbox_id: str, port: int) -> Endpoint:
def get_endpoint(sandbox_id: str, port: int, resolve_internal: bool = False) -> Endpoint:
return Endpoint(endpoint="10.57.1.91:40109")

monkeypatch.setattr(lifecycle, "sandbox_service", StubService())
Expand All @@ -161,7 +162,7 @@ def test_proxy_maps_connect_error_to_502(
) -> None:
class StubService:
@staticmethod
def get_endpoint(sandbox_id: str, port: int) -> Endpoint:
def get_endpoint(sandbox_id: str, port: int, resolve_internal: bool = False) -> Endpoint:
return Endpoint(endpoint="10.57.1.91:40109")

monkeypatch.setattr(lifecycle, "sandbox_service", StubService())
Expand All @@ -185,7 +186,7 @@ def test_proxy_maps_unexpected_error_to_500(
) -> None:
class StubService:
@staticmethod
def get_endpoint(sandbox_id: str, port: int) -> Endpoint:
def get_endpoint(sandbox_id: str, port: int, resolve_internal: bool = False) -> Endpoint:
return Endpoint(endpoint="10.57.1.91:40109")

monkeypatch.setattr(lifecycle, "sandbox_service", StubService())
Expand Down