New Extension for Plesk. Antivirus Protection to enhance your server security. Why choose Flex Antivirus?

API — Web Programming

ASP and PHP Variables — IIS Module

Access from your web page the server variables injected by the Firewall Manager IIS Module. Get the visitor's host, IP, country, and ASN code in real time.

Classic ASP PHP IIS Module Server Variables

From within your web page — for example index.asp or index.php — you can access the server variables injected by the Firewall Manager IIS Module to get enriched information about each incoming request. The IIS Module must be active for these variables to be available.

Available variables


Variable Description
HTTP_X_FIREWALL_HOST Server hostname associated with the incoming request.
HTTP_X_FIREWALL_IP Visitor's real IP address, including support for IPv4 and IPv6.
HTTP_X_FIREWALL_COUNTRY ISO 3166-1 alpha-2 country code corresponding to the visitor's IP (e.g.: ES, US, CN).
HTTP_X_FIREWALL_ASN Autonomous System Number (ASN) associated with the visitor's IP. Allows identifying the source provider or network.

Classic ASP example


Access the variables via the Request.ServerVariables object from any .asp page:

' Read server variables injected by the IIS Module response.write "<br>Host : " & Request.ServerVariables("HTTP_X_FIREWALL_HOST") response.write "<br>IP : " & Request.ServerVariables("HTTP_X_FIREWALL_IP") response.write "<br>Country : " & Request.ServerVariables("HTTP_X_FIREWALL_COUNTRY") response.write "<br>ASN : " & Request.ServerVariables("HTTP_X_FIREWALL_ASN")

PHP example


Access the same variables via the $_SERVER superglobal from any .php file:

// Read server variables injected by the IIS Module echo "<br>Host : " . $_SERVER["HTTP_X_FIREWALL_HOST"]; echo "<br>IP : " . $_SERVER["HTTP_X_FIREWALL_IP"]; echo "<br>Country : " . $_SERVER["HTTP_X_FIREWALL_COUNTRY"]; echo "<br>ASN : " . $_SERVER["HTTP_X_FIREWALL_ASN"];

Variable HTTP_X_FIREWALL_ASN


The ASN (Autonomous System Number) code identifies the network or internet provider the visitor's IP belongs to. It is especially useful for blocking IP ranges associated with hosting providers, bot networks, or specific regions without needing to specify each individual IP.

Full list of ASN codes

You can check the list of available ASN identifiers at the following link:
https://2ip.io/analytics/asn-list/

Requirement: You must have the IIS Module enabled in the Firewall Manager configuration for these variables to be available in HTTP requests. Without the module active, the variables will return an empty value.

These variables are especially useful for implementing custom logic in your web application: showing different content based on the visitor's country, blocking access to administration areas from certain ASN ranges, or logging the geographic information of each access in your own database.