Skip to Content
Self-hostReverse proxy and HTTPS

Reverse Proxy and HTTPS

Out of the box Genfeed listens on plain HTTP on localhost. That is right for a single machine. To reach it from other devices or from the internet, put a reverse proxy in front that terminates HTTPS, and tell Genfeed what its public addresses are.

Plan the addresses

The instance exposes four services. Give each its own hostname, or its own path-routed address if your proxy supports that:

ServiceContainer portExample public address
Web UI3000https://genfeed.example.com
REST API3010https://api.genfeed.example.com
WebSocket / notifications3011https://ws.genfeed.example.com
MCP server3014https://mcp.genfeed.example.com

Only expose the ports you need. PostgreSQL and Redis are not published, and they should stay that way.

Put every public address behind the reverse proxy rather than publishing the container ports to the internet. Compose binds the API host port to 127.0.0.1 by default; a proxy on the Docker host can still reach it. Keep that binding, especially when the login wall is off. Internal containers continue to reach the API over their Docker network.

Use Docker Engine 28 or newer for this loopback isolation. On older versions, other machines on the same network segment may still reach a loopback-published port; upgrade before relying on it. See Docker’s port-publishing documentation .

Tell Genfeed its public URLs

Set these in .env, then recreate the stack (docker compose --env-file .env -f compose.yml up -d):

GENFEEDAI_PUBLIC_URL=https://genfeed.example.com GENFEEDAI_APP_URL=https://genfeed.example.com GENFEEDAI_API_PUBLIC_URL=https://api.genfeed.example.com GENFEEDAI_MCP_PUBLIC_URL=https://mcp.genfeed.example.com/mcp NEXT_PUBLIC_API_ENDPOINT=https://api.genfeed.example.com/v1

The WebSocket endpoint is built into the browser bundle. Build a custom image with --build-arg NEXT_PUBLIC_WS_ENDPOINT=https://ws.genfeed.example.com when using the socket hostname above. A runtime .env change does not replace the published image’s http://localhost:3011 endpoint. The proxy must forward /socket.io/ with WebSocket upgrade support, and only that path: the socket port also serves notification routes, so it is published on 127.0.0.1 only and the proxy must not forward anything else.

If you enable the login wall, also set the origins Better Auth should use:

BETTER_AUTH_URL=https://api.genfeed.example.com BETTER_AUTH_TRUSTED_ORIGINS=https://genfeed.example.com

GENFEEDAI_CDN_URL must be the files-service origin as the browser sees it, for example a public address that proxies to the files service. An internal Docker hostname is not a browser URL. The published image defaults to localhost values for the browser-facing settings, so after changing them open the web UI and check in your browser’s network tools that requests go to your public API address.

Example: Caddy

Caddy  obtains and renews HTTPS certificates automatically. A minimal Caddyfile for the four services (the WebSocket host only passes /socket.io/* through):

genfeed.example.com { reverse_proxy localhost:3000 } api.genfeed.example.com { reverse_proxy localhost:3010 } ws.genfeed.example.com { handle /socket.io/* { reverse_proxy localhost:3011 } handle { respond 404 } } mcp.genfeed.example.com { reverse_proxy localhost:3014 }

Any reverse proxy works the same way: terminate HTTPS and forward each hostname to the matching host port (see SELFHOSTED_*_PORT in Configuration if you changed them). Allow long request durations; watermarked media exports can take up to ten minutes.

Client IP addresses

Genfeed ignores X-Forwarded-For by default, because the published ports are reachable directly and any client could otherwise claim another address and pass ADMIN_ALLOWED_IPS. Behind a proxy, set TRUST_PROXY in .env to an Express trust-proxy value that names your proxy, for example loopback, 172.18.0.0/16, or a proxy address.

Prefer an address or subnet over a hop count such as 1: a hop count trusts whoever connects, so use it only when the proxy is the sole path to every published port. The web app cannot see the connecting peer, so setting TRUST_PROXY also asserts that the web port is reachable only through the proxy.

API access without the login wall

With BETTER_AUTH_ENABLED=false the API treats requests from the machine itself or the Docker network as the seeded local admin, and refuses requests from any other address with 401 unless they carry a valid API key. A request that a reverse proxy forwards for a remote client (it carries X-Forwarded-For or X-Real-IP) is never treated as local, unless TRUST_PROXY names that proxy and the client address it reports is itself local.

A proxy on the same host that sends no client headers looks like a local caller. Docker can also present a published-port connection as its bridge gateway without adding client headers. The API’s loopback host binding closes that public ingress path; the peer-address check alone cannot identify it. Do not put an unauthenticated instance behind a public proxy. Keep the login wall on. With BETTER_AUTH_ENABLED=true, every request needs a token regardless of its source address.

OAuth callbacks

Google sign-in and the Google connectors share one Google Cloud OAuth web client. Register the callbacks on your public origins, keeping each path:

https://api.genfeed.example.com/v1/auth/callback/google https://genfeed.example.com/oauth/youtube https://genfeed.example.com/oauth/google-ads https://genfeed.example.com/oauth/google-search-console

For other publishing providers, register the callbacks documented in the OAuth provider runbook . Unconfigured providers fail closed.

Before you expose it

  • Keep the login wall on (BETTER_AUTH_ENABLED=true, the default). Sign-up is open, so create your own account before exposing the web port; with the wall off, anyone who can reach it can use the workspace. With the wall on, the API also requires a valid token regardless of the caller’s address.
  • Change the bundled PostgreSQL password (POSTGRES_PASSWORD).
  • Keep provider keys in .env only, never in NEXT_PUBLIC_* variables.
  • Set TRUST_PROXY as described above.
  • Remember that MCP authentication is separate from the login wall; see MCP server.
  • Back up PostgreSQL and the /data volume, and read Upgrading before your first update.
  • Confirm the API responds with curl https://api.genfeed.example.com/v1/health. It reports only that the API process is up, not full readiness.

Next

Last updated on