Open WebUI behind HAProxy

Putting HAProxy in front of several Open WebUI replicas spreads users across instances, but only after shared database, Redis and file storage are in place. This page covers the configuration, WebSocket handling, health checks and certificates.

On this page

When HAProxy in front of Open WebUI replicas makes sense

HAProxy makes sense once one Open WebUI container can no longer carry your users, and you are ready to run two or more replicas behind a single entry point. The proxy distributes incoming connections across those replicas, can remove an unhealthy replica from rotation, and gives you one place to terminate TLS and route WebSocket traffic. Teams usually reach this point when concurrent sessions and streaming responses start to queue on one host, or when they want to restart or upgrade one instance without taking the interface offline. Before you build anything, confirm the number of concurrent users you expect and whether your current host has headroom to absorb a restart.

Load balancing alone does not make replicas safe. The Open WebUI scaling guide requires PostgreSQL instead of SQLite for multi-instance deployments, because SQLite does not handle concurrent writes from multiple processes well. It also requires Redis as a shared store for sessions, WebSocket connections and application state, and shared file storage so uploads and knowledge stay reachable from every replica. If HAProxy sends a user's next request to a different replica that cannot see that session, the user is signed out or sees errors that look like a proxy fault. Confirm that all three dependencies exist and are reachable from every replica before you add the second backend server.

Keep the Open WebUI version identical on every replica and pin the image tag rather than using a floating tag. Mixed versions during a rolling change can disagree on database schema and session handling, so plan the upgrade as one coordinated step. Read the current release notes on the Open WebUI releases page before choosing a tag, because the project publishes releases frequently. If you cannot yet support Redis and shared storage, a single well-provisioned replica behind a reverse proxy is the safer choice for your team today.

HAProxy configuration choices and when each fits

This table compares the main HAProxy choices for fronting Open WebUI replicas: how TLS is handled, how sessions stick to a replica, and how connections are balanced. Read each row against your own user count, identity setup and certificate policy, then confirm defaults and timeouts in your HAProxy version and the Open WebUI scaling guide.

DecisionOptionTrade-offWhen it fits
TLS terminationHTTP mode with certificates on HAProxy (certbot)HAProxy reads headers, can route by host or path and apply WebSocket rules, but sees plaintext inside the proxy hostMost teams with one controlled network segment between HAProxy and replicas
TLS terminationTCP passthroughHAProxy cannot read HTTP, so cookie stickiness and header-based rules are unavailable; certificates stay on the backendsOnly when end-to-end encryption to each replica is mandatory and source-IP stickiness is acceptable
TLS terminationRe-encryption to backendsHAProxy terminates client TLS and opens a new TLS session to each replica, adding certificate management on both sidesRegulated environments that require encryption on internal hops as well as at the edge
Session stickinessCookie-based persistenceRequires HTTP mode; HAProxy inserts a cookie naming the replica, so clients behind shared NAT still spread correctlyDefault choice for browser users; confirm Open WebUI works with your chosen cookie name and flags
Session stickinessSource-IP stickinessWorks in TCP mode, but many users behind one corporate NAT land on the same replica and load skewsSmall internal deployments where clients reach HAProxy directly and traffic is not NATed
Balancing algorithmroundrobinSpreads new connections evenly by count, ignoring how long each open stream lastsShort, similar requests where replicas have equal capacity
Balancing algorithmleastconnFavors the replica with fewer open connections, which suits long-lived streaming and WebSocket sessionsChat workloads with long streamed responses; validate the behavior under your own load test
Health checksHTTP check on the application health endpointConfirms the process answers, not that chat, database or Redis paths work end to endStandard starting point; confirm the endpoint path and expected response in your Open WebUI version
TimeoutsClient, server and tunnel timeouts sized for streamingToo short cuts off long model responses and WebSocket sessions; too long holds dead connectionsAlways. Confirm exact values against your HAProxy version and the Open WebUI scaling guide rather than copying defaults

Setup sequence for HAProxy with Open WebUI replicas

This sequence takes a single Open WebUI instance to two or more replicas behind HAProxy, with shared state, WebSocket-aware routing, managed certificates and a sign-out test that proves sessions behave the same on every replica. Each step closes with a check so the next step starts from a known state.

  1. Provision PostgreSQL, Redis and shared file storage

    The platform or database team creates a PostgreSQL database, a Redis instance and a shared file store that every replica can reach over the network. The scaling guide requires PostgreSQL rather than SQLite for multi-instance deployments, and Redis holds sessions, websocket connections and application state. Confirm that each service is reachable from the subnet where the replicas will run, that credentials are stored in your secrets manager, and that the file store is mounted at the same path on every host or container. The step is done when a test connection to each service succeeds from a host in that subnet.

  2. Run Open WebUI replicas against shared services

    The team starts at least two Open WebUI instances using the same database URL, Redis settings, file storage path and secret key. Use one key value for all replicas, because signed tokens must be valid on every instance. Point the vector store at an external database rather than the default ChromaDB, since the scaling guide warns that the default store crashes in multi-process setups. Check each replica's logs for successful database migrations and confirm that only one instance runs schema migrations at startup. The step is done when each replica answers its local HTTP endpoint and reports no connection errors to PostgreSQL, Redis or storage.

  3. Configure HAProxy frontend and backend

    The network team defines an HTTP mode frontend that terminates TLS and a backend that lists every replica as a server entry. Set the backend to round robin or another algorithm your team has tested, and enable WebSocket upgrade handling so that connections carrying the upgrade header pass through to the replicas without being dropped. Set timeouts high enough for long streamed model responses and confirm the values with a test conversation that runs for several minutes. The step is done when haproxy -c -f haproxy.cfg validates the configuration and a request to the frontend reaches a replica.

  4. Add health checks to each backend server

    Each server line in the backend gets an HTTP health check that requests the Open WebUI health endpoint and expects a success response. Set the check interval, rise and fall thresholds according to the environment, and confirm the chosen values in a staging test rather than copying them from another system. Stop one replica on purpose and confirm that HAProxy marks it down and sends new requests only to the healthy instance. Start it again and confirm that it returns to service. The step is done when the HAProxy stats view shows both states correctly.

  5. Issue certificates with certbot and reload on renewal

    The operations team requests a certificate for the public hostname with certbot, using the method that fits the DNS or network setup. HAProxy expects the certificate and private key concatenated in one PEM file, so add a deploy hook that rebuilds that file and reloads HAProxy after each renewal. Use the reload command rather than a restart so that active streams are not dropped. Run the renewal in dry-run mode and confirm that the hook executes. The step is done when a dry run completes and the served certificate shows the expected issuer and expiry.

  6. Verify sign-in, streaming and sign-out across replicas

    The team signs in through the HAProxy address, sends a prompt that streams a long response, then repeats requests until they have landed on different replicas, which you can confirm in the logs of each instance. Next, sign out and confirm that the old session token no longer works on any replica. The scaling guide notes that without Redis, sign-out does not revoke tokens, so a token that still works after sign-out points to a shared-state problem. Also confirm that a file uploaded through one replica is readable through another. The step is done when sign-in, streaming, sign-out and cross-replica file access all behave the same on every instance.

How a request and a WebSocket connection flow through HAProxy to replicas

A browser connects to HAProxy, which terminates TLS and forwards traffic to one of several Open WebUI replicas. Plain requests and WebSocket upgrades take the same entry point but must stay on the replica that accepted them, so the proxy must pass the upgrade handshake through unchanged. Every replica reads and writes the same PostgreSQL database, Redis state store and shared file storage, and the health check path tells HAProxy which replicas can take traffic. Check the upgrade path and the health check first when connections drop after a replica is removed from the pool.

Requests and WebSocket upgrades enter through HAProxy and reach shared state on every replica.

WebSocket and streaming handling by traffic type

Chat responses arrive as a long series of small chunks over a standard HTTP response. HAProxy should forward each chunk to the browser as it arrives, so users see text appear while the model generates it. A proxy that batches output or cuts off a slow generation shows stalled or truncated answers, even when the model and Open WebUI are healthy.

  • Response batching: Check whether compression or other response processing in HAProxy holds chunks until a threshold is reached. Compression is a common cause of output that appears in bursts.
  • Server timeouts: Set the server-side timeout high enough for your slowest model and longest context. Confirm exact values with your model provider and with load tests in your environment.
  • Connection reuse: Review the connection close and keep-alive options, including option http-server-close, so a long stream is not cut when a connection is recycled.
  • Stickiness: A stream must finish on the replica that started it. Confirm how HAProxy keeps HTTP requests from one session on one backend.

Test by streaming a long answer from a slow model through the proxy, then compare the text cadence with a direct connection to a single replica. Confirm the timeout values against your environment before you publish them to users.

Health checks and failure behavior to test

A load balancer in front of Open WebUI replicas is only as good as its answers to three questions: when a replica is pulled out, what users lose, and what happens when shared state fails. The cards below cover the checks and failure drills to run in a staging copy before production traffic arrives, with the Scaling Open WebUI guide as the reference for shared state.

Choose what the health check proves

A HAProxy check that only confirms the TCP port is open will keep a replica in rotation even when the application cannot reach its database or Redis. Pick a health endpoint from the current Open WebUI documentation and confirm what it actually tests before you write the check. Then compare the answer against a real login and a streamed chat response through HAProxy, since a fast 200 response does not prove that streaming works.

Scaling guide

Remove a failed replica from rotation

Set the check interval, fall count and rise count so that a replica is removed quickly and only returns after it passes several checks in a row. Kill a replica's container during a test load and record how many requests fail before HAProxy stops sending traffic to it. Users with an open stream on that replica will lose the stream, so confirm that the browser reconnects and that the interface tells them to retry.

Drain replicas before upgrades

Taking a replica out of service during an upgrade should not cut active conversations. Set the replica to drain in HAProxy so it accepts no new sessions, wait for existing connections to finish, then stop it. Test this with the same image tag you plan to roll out, and confirm that the new replica passes the health check before the next replica is drained.

Session behavior when a replica leaves

Sessions are stored in Redis, so a user's token should remain valid when HAProxy sends the next request to a different replica. Confirm this in staging: sign in, stop the replica that served the session, and send another request. Without Redis, signing out does not revoke tokens, and tokens stay valid until they expire, by default after 4 weeks, so test sign-out on every replica too.

Redis outage across all replicas

When Redis is unreachable, every replica is affected at once, so HAProxy health checks will not isolate the fault. Stop the Redis service in staging and observe which features fail: sign-in, websocket updates, and shared application state. Record the recovery behavior when Redis returns, and confirm with the vendor or your own tests what state, if any, is lost.

PostgreSQL outage and recovery

A PostgreSQL outage also affects all replicas together, and replicas that keep running may return errors without being marked down. Interrupt the database for a short period under test load and check whether each replica recovers its connections without a restart. Confirm the connection pool settings and whether any writes were lost during the outage, and document the steps your team takes to restore service.

Questions teams ask before running Open WebUI behind HAProxy

How much effort does running Open WebUI behind HAProxy take?

The HAProxy layer is the smaller part of the work. The larger effort sits in the shared state Open WebUI needs once more than one replica runs. The main drivers are how many replicas you plan, whether PostgreSQL, Redis and shared file storage already exist, and how much WebSocket and streaming traffic your users generate.

  • Load balancer work: frontend and backend configuration, TLS termination, health checks and WebSocket timeouts.
  • Application work: moving from SQLite to PostgreSQL, adding Redis and shared storage, and an external vector database when you run several workers or replicas.
  • Verification: long conversations, uploads, sign-in flows and a planned replica restart.

Ask any partner to size each of these from your own environment before agreeing on a fixed scope.

Can our own team set up Open WebUI behind HAProxy without a partner?

Yes, if your team already operates HAProxy, PostgreSQL, Redis and certificate automation, because most of the work is configuration and verification of known components. The gap is usually coordination rather than HAProxy itself. Replicas must stay identical, every replica must point at the same database, Redis and file store, and WebSocket behavior must be tested under realistic chat and streaming load. Check whether anyone has run shared session state, connection draining and certificate renewal in production. If one of those is new, plan time to learn it on a staging copy first. A partner suits a fixed scope, and the deciding question is who will carry the on-call work afterward.

What does the deployment need from our infrastructure team?

The deployment needs several shared services before HAProxy can balance traffic safely.

  • PostgreSQL: a shared database, because SQLite does not handle concurrent writes from multiple processes well.
  • Redis: shared state for sessions, WebSocket connections and application state.
  • Shared file storage: uploads and knowledge must be reachable from every replica.
  • An external vector database: the default ChromaDB will crash in multi-process setups.
  • DNS: a name for the HAProxy frontend and records that point to it.
  • Certificates: a way to issue and renew certbot certificates on the HAProxy host, with a reload step after renewal.

Confirm ports, firewall rules and network paths between HAProxy, the replicas and the shared services with your network and database teams before the build starts.

How long does an Open WebUI HAProxy setup take to complete?

No duration applies to every environment, so the timeline should come from the written scope for your environment. Duration grows with the number of replicas, whether PostgreSQL, Redis and shared storage already exist, how many sign-in and access requirements need testing, and how much approval your change process requires. Work moves faster when the shared services are running and the target environment is defined before the build begins. Ask for milestones covering staging tests, production cutover and a verified replica restart, so each stage has a clear finish point.

Do user sessions survive a replica restart behind HAProxy?

They can, when the deployment uses Redis as the shared store for sessions, which the scaling guidance requires for multiple replicas. Without Redis, signing out does not revoke tokens, and they stay valid until they expire, by default after 4 weeks, so that gap needs a plan. With Redis in place, a session should not depend on which replica a user reached, so a restarted replica should not sign that user out. Be precise about what does not carry over: a response still streaming from the restarted replica and any WebSocket connection held there will drop, and the browser must reconnect. Confirm this with a test during a planned restart before you rely on it. Scaling Open WebUI

Does the Open WebUI License change once user counts grow?

Yes. Code through v0.6.5 remains BSD-3-Clause, while releases from v0.6.6 onward fall under the Open WebUI License, which adds a branding protection clause. That clause forbids altering or removing Open WebUI branding in deployments that exceed 50 users in any rolling 30-day period, unless the operator holds an enterprise license or written contributor permission. Because the window is rolling, a team that passes 50 users in a busy month can be affected even if usage later drops. Enterprise licenses allow white-labeling and custom branding. Pricing is not published, and a quote follows from contacting enterprise sales with an expected seat count. Read the license terms yourself and confirm how users are counted before you plan the rollout.

What should HAProxy health checks and WebSocket routing verify?

Health checks should confirm that a replica can serve real requests, so point them at a path that reflects application health rather than only an open TCP port. Routing should also verify that WebSocket upgrades pass through correctly, that idle timeouts are long enough for slow model responses, and whether the frontend keeps a user on one replica when your configuration requires it. Health-check paths, timeouts and stickiness rules must be confirmed against the exact Open WebUI version you deploy, since the project ships new releases, most recently v0.12.3 in October 2026. Test by stopping one replica during an active chat and checking that the others take over cleanly.

What the Open WebUI License means once several replicas serve users

Adding replicas does not change the license, but it can change which terms apply to you. Since v0.6.6 (April 19, 2025), Open WebUI code is distributed under the Open WebUI License, which adds a branding protection clause. Code through v0.6.5 remains BSD-3-Clause. The clause forbids altering or removing Open WebUI branding in deployments that exceed 50 users in any rolling 30-day period, unless the operator holds an enterprise license or written contributor permission. A HAProxy frontend in front of several replicas makes it easy to serve a large user base without anyone reviewing this threshold, so count active users per rolling 30-day window before you change the interface theme, logo or footer.

Check the threshold with the people who own the license decision, not only the platform team. Ask legal or procurement to confirm how your organization counts users, including contractors, service accounts and users who sign in through SSO. Then record the decision next to the HAProxy and Redis configuration, so an upgrade or a change in headcount does not silently breach the terms. Read the current text in the Open WebUI License documentation before you rely on this summary, since license wording is the authoritative source.

Enterprise licensing is quoted, not listed. Open WebUI offers enterprise licenses that allow white-labeling and custom branding, with dedicated support options. Pricing is not published. You request a quote from enterprise sales with an expected seat count, so prepare that figure from your active-user count and growth plan. Ask the vendor to state in writing what the license covers, whether it applies to every replica and environment, how renewals work, and what support levels are included, so the quote can be compared with the cost of your own branding changes and support.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.