Metadata API

The edge functions on Edge Firewall have access to a set of metadata that can be manipulated to:

  • Filter and manage access to your application.
  • Apply specific logic in different scenarios.

This reference documentation describes the available metadata and their usage.


GeoIP

The GeoIP metadata provides information on the geographical location of the client based on IP data.

NameDescription
geoip_asnAutonomous system number
geoip_cityCity code
geoip_city_continent_codeCity continent code information
geoip_city_country_codeCity country code
geoip_city_country_nameCity country name
geoip_continent_codeContinent code
geoip_country_codeCountry code
geoip_country_nameCountry name
geoip_regionRegion code
geoip_region_nameRegion name

Remote

The Remote metadata provides details about the remote client’s IP address and TCP port.

NameDescription
remote_addrRemote (client) IP address
remote_portRemote (client) TCP port
remote_userUser informed in the URL. Example: user in http://user@site.com/

Server

The Server metadata provides details about the protocol being used in the request.

NameDescription
server_protocolProtocol being used in the request. Example: HTTP/1.1

TLS

The TLS metadata provides details about TLS certificates.

NameDescription
ssl_cipherTLS cipher used
ssl_protocolTLS protocol used

Server Fingerprints

The Server Fingerprints metadata provides TLS fingerprinting information for enhanced security analysis.

NameDescription
server_fingerprintServer TLS fingerprint
server_fingerprint_ja4hServer JA4H fingerprint

Identifiers

NameDescription
solution_idInternal identifier of the Solution (bundle of products) handling the request.
client_idIdentifier of the Azion account (client) that owns the workload.
function_idIdentifier of the Edge Function instance executed for this request.
configuration_idIdentifier of the Edge Function configuration (version / revision) applied.
virtualhost_idIdentifier of the Virtual Host (Edge Application domain) that received the request.
edge_connector_idIdentifier of the Edge Connector used when the request is routed through a connector. A dash (-) is returned when none is involved.
request_idGlobally-unique ID automatically attached to every request; useful for end-to-end tracing.

Usage

You can access the metadata through event.request.metadata["remote_addr"], as in:

let ip = event.request.metadata["remote_addr"] // Accessing the remote address

Implementation

In the code sample below:

  • The remote address is accessed.
  • It’s verified if this address is in a network list.
  • If it’s in the network list, the request is denied.
addEventListener("firewall", (event) => {
let ip = event.request.metadata["remote_addr"] // Accessing the remote address
try {
let found = Azion.networkList.contains(String(networkListId), ip); // Checking if the ip is in the list
if (found) {
event.deny(); // If it's in the list, deny the request
}
} catch (err) {
event.console.error(`Error: `, err.stack);
}
});