Enable F5 OneConnect for Cookie Persistence Behind a Reverse Proxy
F5 BIG-IP cookie persistence can silently fail when the client of the F5 virtual server (VS) isn't a browser but a reverse proxy, which shares its connections to the F5 across many users. This affects two common Datawiza Access Proxy (DAP) deployments:
| Setup | Proxy in front of the F5 | F5 balances | What users see |
|---|---|---|---|
| 1. F5 in front of DAP, behind another proxy | Cloudflare, another CDN, or another reverse proxy | Multiple DAP instances | An endless sign-in redirect loop to the identity provider (IdP), or 403 responses followed by a redirect to /ab-login |
| 2. F5 behind DAP | DAP | Backend application servers | Logged out of the application, or the application's "session expired" message, during active use |
The problem doesn't occur when each browser opens its own connections to the F5, which is why users who bypass the proxy aren't affected. In both setups, the fix is the same: attach a OneConnect profile to the F5 virtual server.
No proxy in front of the F5?
If browsers connect straight to an F5 that balances multiple DAP instances, you only need persistence on the F5. See Configure Session Persistence (Sticky Sessions).
Why It Happens
Without a OneConnect profile, the F5 makes its load-balancing and persistence decision only on the first request of each client-side TCP connection. Every later request on that same keep-alive connection goes to the same pool member, whatever persistence cookie it carries (F5 K7964: Persistence may fail for subsequent requests on Keep-Alive connections).
That's fine when each client is a browser with its own connections. A reverse proxy behaves differently: it keeps a pool of keep-alive connections to the F5 and reuses them for requests from all users. A connection that was first opened for user A, and so bound by the F5 to the pool member holding user A's session, may later carry a request from user B. The F5 forwards user B's request to user A's pool member and ignores user B's BIGipServer<pool> persistence cookie. That pool member has no session for user B:
- In setup 1, with DAP's default Session Option (
Server Side), each DAP instance keeps its own sessions, so the instance treats the user as unauthenticated and restarts sign-in. The next request may land on yet another instance, so the user can keep looping between the IdP and DAP. - In setup 2, the application server treats the request as a timed-out session.
With a OneConnect profile attached, the F5 detaches each client-side request from the server-side connection and makes the persistence decision per request, so every request goes to the pool member named in that user's persistence cookie.
In setup 1, CDNs such as Cloudflare reuse their connections to the origin across users. In setup 2, DAP always uses keep-alive connections to the upstream, and there's no setting to turn this off. Either way, the fix belongs on the F5.
Use cookie persistence, not source-address persistence
Behind DAP, a CDN, or another reverse proxy, every request reaches the F5 from the proxy's IP addresses, not the user's. Source-address (IP) persistence then pins users by the proxy's address rather than individually, and sends many unrelated users to the same pool member. In setup 1, with a CDN such as Cloudflare, one user's requests can also arrive from several different edge IP addresses, so that user is still spread across DAP instances. Use cookie persistence on the virtual server, together with OneConnect.
Prerequisites on the F5
- The virtual server is type Standard and has an HTTP profile attached. Cookie persistence needs the HTTP profile, and without it OneConnect can't make a decision per request.
- If the virtual server receives HTTPS, it terminates TLS: it has a Client SSL profile attached, plus a Server SSL profile if the pool members use HTTPS. Without them, the F5 can't read the HTTP requests or their cookies, so a TLS pass-through virtual server can't use cookie persistence or OneConnect. HTTPS is common in both setups, for example when Cloudflare connects in
FullorFull (strict)SSL mode, or when DAP connects to anhttps://application. - If the pool members use HTTPS, the Server SSL profile verifies their certificates. The built-in
serversslprofile doesn't do this by default. In a custom Server SSL profile, setServer Certificatetorequire, setTrusted Certificate Authoritiesto the CA that issued the DAP or application certificate, and setAuthenticate Nameto the expected server name. This matters most with CloudflareFull (strict): once the F5 terminates TLS, Cloudflare only verifies the F5's certificate, so the F5 → DAP connection is authenticated only if the Server SSL profile checks it. - The virtual server uses cookie persistence, in both setups. See the warning above for why source-address persistence doesn't work behind a reverse proxy. Enable OneConnect includes a step to check this.
- In setup 2, find out whether SNAT (Source Address Translation) is enabled on the virtual server. This helps decide whether you need a custom source mask (see Choose a Source Mask).
- If the BIG-IP is part of an HA pair, plan to sync the configuration to the peer afterwards.
Enable OneConnect
The steps below use the built-in oneconnect profile in the BIG-IP Configuration Utility. Read Choose a Source Mask first to check whether you need a custom profile instead.
- Go to
Local Traffic→Virtual Servers→Virtual Server List, and click the virtual server that receives traffic from the reverse proxy: the DAP virtual server in setup 1, or the backend application's virtual server in setup 2. - On the
Propertiestab, changeConfigurationfromBasictoAdvanced. - Under
Acceleration, setOneConnect Profiletooneconnect(or your custom profile). - Click
Update. - On the
Resourcestab, check thatDefault Persistence Profileiscookie. If it'sNoneor another profile, such assource_addr, set it tocookieand clickUpdate. - If the BIG-IP is in an HA pair and its device group doesn't use Automatic Sync, sync the change to the peer. On the BIG-IP where you made the change, go to
Device Management→Overview, select the device group, select this device, choosePush the selected device configuration to the group, and clickSync. Don't push from the peer or pull to this device: that overwrites your change with the peer's old configuration.
If the virtual server also serves clients that use NTLM (Windows Integrated Authentication), also attach an NTLM profile, as F5 recommends for NTLM traffic with OneConnect.
Choose a Source Mask
Setup 1 (F5 in front of DAP): use the built-in oneconnect profile. No custom profile is needed. DAP's access rules and logs don't use the connection's source IP: DAP reads the client IP from the X-Real-IP header, or else from the first address in X-Forwarded-For, which Cloudflare and most reverse proxies add to every request. These headers reflect the user's real address only when a trusted proxy in front of DAP sets or cleans them.
DAP balancing several application servers
DAP's own load balancing does use the connection's source IP: the default Load Balance Method, and Source IP, hash it. Behind a CDN, and with OneConnect, one user's requests can reach DAP from different source IPs, so DAP can send that user to different application servers. If DAP balances several application servers and the application needs session affinity, set the application's Load Balance Method to Active Cookie in DAP. A custom source mask doesn't fix this.
Setup 2 (F5 behind DAP): use the built-in oneconnect profile, unless both of the following are true. In that case, create a custom profile with source mask 255.255.255.255, as described below.
- SNAT is off on the virtual server: on its
Propertiestab,Source Address TranslationisNone. - The application relies on the connection's source IP rather than the
X-Forwarded-Forheader. For example, it only accepts connections from DAP's IP, as recommended for header-based authentication in Network Restriction, or it uses the source IP for another allowlist or in its logs.
Why it matters: the built-in profile lets a request reuse a server-side connection that the F5 opened for a different client. With SNAT off, the application then sees that other client's IP as the connection's source. This applies to any client that can reach the virtual server, not only clients you expect. If the application trusts DAP by its IP, another client's request can travel on a connection the F5 opened for DAP and get past that restriction, for example with a forged identity header. Multiple DAP instances are also different clients, if the application needs to tell them apart by IP. A custom profile with source mask 255.255.255.255 only reuses connections opened for the same client IP.
To create a custom profile:
- Go to
Local Traffic→Profiles→Other→OneConnect, and clickCreate. - Enter a
Name, for exampleoneconnect-32, and keepParent Profileset tooneconnect. - Check the
Custombox next toSource Mask, and set it to255.255.255.255. - Click
Finished.
Then select your custom profile instead of oneconnect in Enable OneConnect.
Verify
- Open the virtual server's
Propertiestab again, withConfigurationset toAdvanced, and confirm thatOneConnect ProfileunderAccelerationshowsoneconnect(or your custom profile). On theResourcestab, confirm thatDefault Persistence Profileshowscookie. - Have affected users work normally through the proxy. In setup 1, the sign-in loop should stop. In setup 2, session timeouts during active use should stop.
In setup 2, the application's own idle timeout still applies. For example, JDE's session timeout, set in Server Manager, still shows a "session expired" message after the configured idle period. That's expected and unrelated to this issue.
Rollback
To remove the profile, open the virtual server's Properties tab, set OneConnect Profile under Acceleration back to None, and click Update. If the BIG-IP is in an HA pair, sync the change from this device to the group, as in Enable OneConnect.
