Trouble connecting to private app

For those who come across the same problem, here’s a short summary:

  1. Make sure your app is bind to :: instead of 0.0.0.0. In my case, I had to specify :: in Dockerfile for my python app like so:
FROM python:3.10-slim-bullseye

ENV PYTHONUNBUFFERED True
ENV APP_HOME /app
WORKDIR $APP_HOME
COPY . ./

RUN pip install --no-cache-dir -r requirements.txt

CMD ["uvicorn", "main:app", "--host", "::", "--port", "8080"]
  1. If you’re using http clients like Req or Finch, make sure you explicitly enable inet6 because Fly uses IPv6 for private apps [1].
> req = Req.new(url: "http://private-app.internal:8080", connect_options: [transport_opts: [inet6: true]])

[2][3]

  1. Make sure to connect over plaintext http [4].

And boom! Problem solved!

References

  1. 6PN addressing clarification - Fly.io
  2. Connect to IPv6 addresses · Issue #554 · benoitc/hackney · GitHub
  3. IPv6 Documentation · Issue #163 · sneako/finch · GitHub
  4. Trouble connecting to private app - #4 by ignoramous - elixir - Fly.io?
1 Like