| Requirement: A virtual server serves multiple websites with content routing enabled. The script must extract the HTTP Host or URL from the client request and route traffic to the proper server pool. - Create Scripting: Server Load Balance -> Scripting -> Create New.
- Define name.
- Input a Lua script statement.
- Select Save.
when HTTP_REQUEST { local host = (HTTP:header_get_value("Host") or ""):lower() local uri = (HTTP:uri_get() or HTTP:path_get() or "/"):lower() if host == "web1.dvwa.ftntlab" then LB:routing("dvwa1") elseif host == "web2.dvwa.ftntlab" and (uri:find("/index.php", 1, true) or uri:find("/login.php", 1, true)) then LB:routing("dvwa2") elseif host == "web3.dvwa.ftntlab" then LB:routing("dvwa3") end }  Assign a virtual server with the created script. Server Load Balance -> Virtual Server -> Edit respective virtual server -> Enable Scripting -> Select created script.  Demonstration: - Simulate a request to FortiADC virtual server, e.g, https://web3.dvwa.ftntlab/login.php
- Expect script to gather HTTP requests information; HTTP Host and URL, then forward traffic to the correct content routing and server pool.
FortiADC virtual server traffic log:  Debugging commands for troubleshooting: diagnose debug module httproxy scripting set diagnose debug module httproxy scripting_minor set diagnose debug enable Disable debugging output: diagnose debug disable diagnose debug module httproxy all unset Related documentation about Scripting: HTTP Scripting HTTP Scripting examples |