Variables
Available Variables
Section titled “Available Variables”Iridium provides several built-in variables that can be used within host configuration files to customize responses and behavior. These variables can be included in the content
field of a location block to dynamically insert information about the request or server.
$user_agent # The User-Agent string from the client's request headers.$remote_addr # The IP address of the client making the request.$host # The Host header from the client's request.$path # The path of the request (e.g., /index.html).$query_string # The query string of the request (e.g., ?id=123).$method # The HTTP method of the request (e.g., GET, POST).$scheme # The scheme of the request (http or https).
Example Usage
Section titled “Example Usage”Here is an example of how to use these variables in a host configuration file:
domain: example.comlocations:- match: '/user-agent' content: 'Your user agent is: <code>$user_agent</code>'- match: '/ip' content: 'Your IP address is: <code>$remote_addr</code>'