Files
floci/docs/getting-started
Hector Ventura a2d02ef967 feat(core): relay container callbacks to a loopback Floci on a Linux host (#5774)
* feat(core): relay container callbacks to a loopback Floci on a Linux host

Containers Floci starts call back through host.docker.internal, which native
Linux Docker maps to the bridge gateway (host-gateway, normally 172.17.0.1).
Docker Desktop forwards that address to the host's loopback, but Linux does
not, so a Floci binary run on a Linux host and bound to 127.0.0.1 (the default)
refused every SDK call from a Lambda function, ECS task or CodeBuild build.
The documented workaround was to listen on 0.0.0.0 with the exposure consent.

BridgeGatewayRelay now listens on the default bridge's gateway address, which
belongs to the host but is not routed from the LAN, and pipes each connection
to Floci's port on loopback. It runs only on a Linux host outside a container,
only while the public listener is on loopback, and only when Docker answers.
The quick start says so.

Refs #5767

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* fix(core): relay every port containers call and close cleanly on shutdown

Review follow-ups for the bridge gateway relay:

- It relays the ports ContainerReachableEndpoint advertises: without TLS the
  HTTP server's port, which can differ from floci.port; with TLS the
  proxy's public port plus its AWS-HTTPS port (a failed bind on that
  privileged port is logged at debug, as the proxy's own is warned once).
- It forwards to the loopback address Floci listens on (::1, localhost,
  127.0.0.2, ...) instead of always 127.0.0.1.
- A shutdown racing the network lookup or a bind closes whatever the
  startup opens afterwards.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* fix(core): relay only connections that come from a Docker network

Linux accepts packets for any of its own addresses on any interface, so a
LAN neighbour that routes the bridge gateway address through this host could
reach the relay and, through it, a Floci bound to loopback.

The relay now reads every Docker network's subnets and relays a connection
only when its source lies in one of them; anything else is closed. A source
outside the known subnets refreshes the list once, at most every five
seconds, so a network created after startup is picked up.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-16 07:05:34 -04:00
..