On this page
A virtual server on BIG-IP 21.1 in front of the inference gateway, a monitor that asks for the model rather than the port, and an Advanced WAF policy built from an OpenAPI file of the OpenAI-style API: through it, all 8 requests outside the API's shape were blocked, every valid one passed, and the stream stayed unbuffered. Attack strings inside a valid prompt passed too, and this post explains why that is correct. This is part 10 of Inference-Aware Load Balancing for LLMs, configured on camera, from a client across the lab's firewall. It goes with a video on the LevelUP I.T. YouTube channel.

Why a BIG-IP in front of the gateway
The inference gateway knows models, prefixes and queues; it does not own the edge. The edge owns one stable address for many gateways and clusters, TLS, per-client limits, and a security policy that knows the API. The path: pc1, the border leaf, the firewall, the service leaf, lb-f5a, then the NGINX data-plane pod, the router and a replica. lb-f5a reaches the NGINX pod directly: the cluster advertises its pod /24s over BGP.
bigip 'tmsh show sys version; tmsh list sys provision ltm asm level; tmsh list ltm virtual'
Version 21.1.0
level nominal (ltm, asm; no virtual servers)
bigip ip route get $NG
10.244.2.201 via 10.254.7.1 dev transit-leaf1b src 10.254.7.3Step 1: the virtual server
Generated lab/bigip/llm-vs.sh, applied with the NGINX pod's address (sed s/NGINX_POD/$NG/ bigip/llm-vs.sh | bigip bash):
tmsh create ltm monitor http llm-models send "GET /v1/models HTTP/1.1\r\nHost: llm.f5lab.test\r\nConnection: close\r\n\r\n" recv "lfm2.5-1.2b" interval 5 timeout 16
tmsh create ltm pool llm-ngf members add { NGINX_POD:80 } monitor llm-models
tmsh create ltm profile http llm-http-xff defaults-from http insert-xforwarded-for enabled
tmsh create ltm virtual vs-llm-waf destination 10.20.30.161:80 ip-protocol tcp profiles add { tcp llm-http-xff } pool llm-ngf source-address-translation { type automap }An L7 virtual server (an HTTP profile), because the WAF and X-Forwarded-For need HTTP; SNAT automap, because the BIG-IP is not the pods' gateway.
A monitor that checks the model
A TCP monitor proves the port answers, and NGINX answers on 80 with every replica down. An HTTP monitor without a receive string accepts any reply: in this series' probes on the earlier BIG-IP 17.5 lab, CIS's default IngressLink monitor sent a request without a Host header, NGINX answered 400, and the member stayed up. This monitor asks the gateway the question a client asks, through the route, the picker and a replica, and requires the model's name. Its cost: one request every 5 s reaching a model server.