Overview
Lua scripting in FortiADC allows you to customize the behavior of your application delivery controller using Lua scripts. FortiADC supports Lua scripting primarily for defining custom content rules, manipulating HTTP requests and responses (through HTTP Scripting), manipulating TCP or UDP requests and responses (through Stream Scripting), and performing advanced traffic handling tasks.
The following outlines the basic overview of how Lua scripting works in FortiADC:
Integration with FortiADC
Lua scripting is integrated into the FortiADC platform, allowing you to write Lua scripts that can be executed at various stages of the request-response cycle.
Event Triggers
Lua scripts can be triggered at different stages of the HTTP, TCP, or UDP request-response cycle. This includes events such as when a request is received, before forwarding a request to the backend server, or after receiving a response from the server.
Access to Request and Response Data
Lua scripts have access to the request and response data, for HTTP Scripting, this includes headers, cookies, and payloads. This allows you to inspect and modify the request and response as needed.
Custom Logic
You can write custom logic in Lua scripts to implement specific functionality based on your requirements. This could include routing decisions, content manipulation, header enrichment, authentication, logging, and more.
Integration with FortiADC Features
Lua scripting can be used to extend the capabilities of FortiADC by integrating with its features such as load balancing, SSL offloading, caching, and traffic management policies.
HTTP Scripting and Stream Scripting
FortiADC supports two types of Lua scripting implementation: HTTP Scripting and Stream Scripting. HTTP Scripting is supported in Layer 2 and Layer 7 HTTP/HTTPS virtual servers, whereas Stream Scripting is support in Layer 7 TCP or UDP virtual servers.
For details, please refer to the respective sections for HTTP Scripting and Stream Scripting.