NGINX · Schema

HttpRequest

The HTTP request object (r) available in ngx_http_js_module handlers. Provides access to client request data and methods to produce a response.

API GatewayCachingCloud NativeLoad BalancerOpen SourceReverse ProxyWeb Server

Properties

Name Type Description
args object Request arguments object parsed from the query string. Duplicate keys are returned as arrays.
headersIn object Incoming request headers object.
headersOut object Outgoing response headers object (writable before headers are sent).
httpVersion string HTTP version of the request.
internal boolean True if the request is to an internal location.
method string HTTP method (GET, POST, etc.).
remoteAddress string Client IP address.
requestBuffer string Client request body as a Buffer (since 0.5.0).
requestText string Client request body as a string.
responseBuffer string Subrequest response body as a Buffer.
responseText string Subrequest response body as a string.
rawHeadersIn array Raw incoming headers as an array of [name, value] pairs.
rawHeadersOut array Raw outgoing headers as an array of [name, value] pairs.
status integer HTTP response status code (writable).
uri string Current URI of the request.
variables object NGINX variables object (writable for variables declared in config).
rawVariables object NGINX variables as Buffers (writable, since 0.5.0).
parent object Reference to the parent request object (for subrequests).
View JSON Schema on GitHub

JSON Schema

njs-http-request-schema.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/nginx/refs/heads/main/json-schema/njs-http-request-schema.json",
  "title": "HttpRequest",
  "description": "The HTTP request object (r) available in ngx_http_js_module handlers. Provides access to client request data and methods to produce a response.",
  "type": "object",
  "properties": {
    "args": {
      "type": "object",
      "additionalProperties": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        ]
      },
      "readOnly": true,
      "description": "Request arguments object parsed from the query string. Duplicate keys are returned as arrays.",
      "example": {}
    },
    "headersIn": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "readOnly": true,
      "description": "Incoming request headers object.",
      "example": {}
    },
    "headersOut": {
      "type": "object",
      "additionalProperties": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        ]
      },
      "description": "Outgoing response headers object (writable before headers are sent).",
      "example": {}
    },
    "httpVersion": {
      "type": "string",
      "readOnly": true,
      "description": "HTTP version of the request.",
      "example": "1.1"
    },
    "internal": {
      "type": "boolean",
      "readOnly": true,
      "description": "True if the request is to an internal location.",
      "example": false
    },
    "method": {
      "type": "string",
      "readOnly": true,
      "description": "HTTP method (GET, POST, etc.).",
      "example": "GET"
    },
    "remoteAddress": {
      "type": "string",
      "readOnly": true,
      "description": "Client IP address.",
      "example": "192.168.1.100"
    },
    "requestBuffer": {
      "type": "string",
      "format": "binary",
      "readOnly": true,
      "description": "Client request body as a Buffer (since 0.5.0).",
      "example": "AQID"
    },
    "requestText": {
      "type": "string",
      "readOnly": true,
      "description": "Client request body as a string.",
      "example": "{\"action\":\"process\"}"
    },
    "responseBuffer": {
      "type": "string",
      "format": "binary",
      "readOnly": true,
      "description": "Subrequest response body as a Buffer.",
      "example": "AQID"
    },
    "responseText": {
      "type": "string",
      "readOnly": true,
      "description": "Subrequest response body as a string.",
      "example": "{\"result\":\"success\"}"
    },
    "rawHeadersIn": {
      "type": "array",
      "items": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "minItems": 2,
        "maxItems": 2
      },
      "readOnly": true,
      "description": "Raw incoming headers as an array of [name, value] pairs.",
      "example": []
    },
    "rawHeadersOut": {
      "type": "array",
      "items": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "minItems": 2,
        "maxItems": 2
      },
      "readOnly": true,
      "description": "Raw outgoing headers as an array of [name, value] pairs.",
      "example": []
    },
    "status": {
      "type": "integer",
      "description": "HTTP response status code (writable).",
      "example": 200
    },
    "uri": {
      "type": "string",
      "readOnly": true,
      "description": "Current URI of the request.",
      "example": "/api/v1/resource"
    },
    "variables": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "NGINX variables object (writable for variables declared in config).",
      "example": {}
    },
    "rawVariables": {
      "type": "object",
      "additionalProperties": {
        "type": "string",
        "format": "binary"
      },
      "description": "NGINX variables as Buffers (writable, since 0.5.0).",
      "example": {}
    },
    "parent": {
      "description": "Reference to the parent request object (for subrequests).",
      "readOnly": true,
      "allOf": [
        {
          "type": "object",
          "description": "The HTTP request object (r) available in ngx_http_js_module handlers. Provides access to client request data and methods to produce a response.",
          "properties": {
            "args": {
              "type": "object",
              "additionalProperties": {
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                ]
              },
              "readOnly": true,
              "description": "Request arguments object parsed from the query string. Duplicate keys are returned as arrays.",
              "example": {}
            },
            "headersIn": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              },
              "readOnly": true,
              "description": "Incoming request headers object.",
              "example": {}
            },
            "headersOut": {
              "type": "object",
              "additionalProperties": {
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                ]
              },
              "description": "Outgoing response headers object (writable before headers are sent).",
              "example": {}
            },
            "httpVersion": {
              "type": "string",
              "readOnly": true,
              "description": "HTTP version of the request.",
              "example": "1.1"
            },
            "internal": {
              "type": "boolean",
              "readOnly": true,
              "description": "True if the request is to an internal location.",
              "example": false
            },
            "method": {
              "type": "string",
              "readOnly": true,
              "description": "HTTP method (GET, POST, etc.).",
              "example": "GET"
            },
            "remoteAddress": {
              "type": "string",
              "readOnly": true,
              "description": "Client IP address.",
              "example": "192.168.1.100"
            },
            "requestBuffer": {
              "type": "string",
              "format": "binary",
              "readOnly": true,
              "description": "Client request body as a Buffer (since 0.5.0).",
              "example": "AQID"
            },
            "requestText": {
              "type": "string",
              "readOnly": true,
              "description": "Client request body as a string.",
              "example": "{\"action\":\"process\"}"
            },
            "responseBuffer": {
              "type": "string",
              "format": "binary",
              "readOnly": true,
              "description": "Subrequest response body as a Buffer.",
              "example": "AQID"
            },
            "responseText": {
              "type": "string",
              "readOnly": true,
              "description": "Subrequest response body as a string.",
              "example": "{\"result\":\"success\"}"
            },
            "rawHeadersIn": {
              "type": "array",
              "items": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "minItems": 2,
                "maxItems": 2
              },
              "readOnly": true,
              "description": "Raw incoming headers as an array of [name, value] pairs.",
              "example": []
            },
            "rawHeadersOut": {
              "type": "array",
              "items": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "minItems": 2,
                "maxItems": 2
              },
              "readOnly": true,
              "description": "Raw outgoing headers as an array of [name, value] pairs.",
              "example": []
            },
            "status": {
              "type": "integer",
              "description": "HTTP response status code (writable).",
              "example": 200
            },
            "uri": {
              "type": "string",
              "readOnly": true,
              "description": "Current URI of the request.",
              "example": "/api/v1/resource"
            },
            "variables": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              },
              "description": "NGINX variables object (writable for variables declared in config).",
              "example": {}
            },
            "rawVariables": {
              "type": "object",
              "additionalProperties": {
                "type": "string",
                "format": "binary"
              },
              "description": "NGINX variables as Buffers (writable, since 0.5.0).",
              "example": {}
            },
            "parent": {
              "description": "Reference to the parent request object (for subrequests).",
              "readOnly": true,
              "allOf": [
                {
                  "type": "object",
                  "description": "The HTTP request object (r) available in ngx_http_js_module handlers. Provides access to client request data and methods to produce a response.",
                  "properties": {
                    "args": {
                      "type": "object",
                      "additionalProperties": {
                        "oneOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        ]
                      },
                      "readOnly": true,
                      "description": "Request arguments object parsed from the query string. Duplicate keys are returned as arrays.",
                      "example": {}
                    },
                    "headersIn": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "readOnly": true,
                      "description": "Incoming request headers object.",
                      "example": {}
                    },
                    "headersOut": {
                      "type": "object",
                      "additionalProperties": {
                        "oneOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        ]
                      },
                      "description": "Outgoing response headers object (writable before headers are sent).",
                      "example": {}
                    },
                    "httpVersion": {
                      "type": "string",
                      "readOnly": true,
                      "description": "HTTP version of the request.",
                      "example": "1.1"
                    },
                    "internal": {
                      "type": "boolean",
                      "readOnly": true,
                      "description": "True if the request is to an internal location.",
                      "example": false
                    },
                    "method": {
                      "type": "string",
                      "readOnly": true,
                      "description": "HTTP method (GET, POST, etc.).",
                      "example": "GET"
                    },
                    "remoteAddress": {
                      "type": "string",
                      "readOnly": true,
                      "description": "Client IP address.",
                      "example": "192.168.1.100"
                    },
                    "requestBuffer": {
                      "type": "string",
                      "format": "binary",
                      "readOnly": true,
                      "description": "Client request body as a Buffer (since 0.5.0).",
                      "example": "AQID"
                    },
                    "requestText": {
                      "type": "string",
                      "readOnly": true,
                      "description": "Client request body as a string.",
                      "example": "{\"action\":\"process\"}"
                    },
                    "responseBuffer": {
                      "type": "string",
                      "format": "binary",
                      "readOnly": true,
                      "description": "Subrequest response body as a Buffer.",
                      "example": "AQID"
                    },
                    "responseText": {
                      "type": "string",
                      "readOnly": true,
                      "description": "Subrequest response body as a string.",
                      "example": "{\"result\":\"success\"}"
                    },
                    "rawHeadersIn": {
                      "type": "array",
                      "items": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "minItems": 2,
                        "maxItems": 2
                      },
                      "readOnly": true,
                      "description": "Raw incoming headers as an array of [name, value] pairs.",
                      "example": []
                    },
                    "rawHeadersOut": {
                      "type": "array",
                      "items": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "minItems": 2,
                        "maxItems": 2
                      },
                      "readOnly": true,
                      "description": "Raw outgoing headers as an array of [name, value] pairs.",
                      "example": []
                    },
                    "status": {
                      "type": "integer",
                      "description": "HTTP response status code (writable).",
                      "example": 200
                    },
                    "uri": {
                      "type": "string",
                      "readOnly": true,
                      "description": "Current URI of the request.",
                      "example": "/api/v1/resource"
                    },
                    "variables": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "description": "NGINX variables object (writable for variables declared in config).",
                      "example": {}
                    },
                    "rawVariables": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string",
                        "format": "binary"
                      },
                      "description": "NGINX variables as Buffers (writable, since 0.5.0).",
                      "example": {}
                    },
                    "parent": {
                      "description": "Reference to the parent request object (for subrequests).",
                      "readOnly": true,
                      "allOf": [
                        {
                          "type": "object",
                          "description": "The HTTP request object (r) available in ngx_http_js_module handlers. Provides access to client request data and methods to produce a response.",
                          "properties": {
                            "args": {
                              "type": "object",
                              "additionalProperties": {
                                "oneOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  }
                                ]
                              },
                              "readOnly": true,
                              "description": "Request arguments object parsed from the query string. Duplicate keys are returned as arrays.",
                              "example": {}
                            },
                            "headersIn": {
                              "type": "object",
                              "additionalProperties": {
                                "type": "string"
                              },
                              "readOnly": true,
                              "description": "Incoming request headers object.",
                              "example": {}
                            },
                            "headersOut": {
                              "type": "object",
                              "additionalProperties": {
                                "oneOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  }
                                ]
                              },
                              "description": "Outgoing response headers object (writable before headers are sent).",
                              "example": {}
                            },
                            "httpVersion": {
                              "type": "string",
                              "readOnly": true,
                              "description": "HTTP version of the request.",
                              "example": "1.1"
                            },
                            "internal": {
                              "type": "boolean",
                              "readOnly": true,
                              "description": "True if the request is to an internal location.",
                              "example": false
                            },
                            "method": {
                              "type": "string",
                              "readOnly": true,
                              "description": "HTTP method (GET, POST, etc.).",
                              "example": "GET"
                            },
                            "remoteAddress": {
                              "type": "string",
                              "readOnly": true,
                              "description": "Client IP address.",
                              "example": "192.168.1.100"
                            },
                            "requestBuffer": {
                              "type": "string",
                              "format": "binary",
                              "readOnly": true,
                              "description": "Client request body as a Buffer (since 0.5.0).",
                              "example": "AQID"
                            },
                            "requestText": {
                              "type": "string",
                              "readOnly": true,
                              "description": "Client request body as a string.",
                              "example": "{\"action\":\"process\"}"
                            },
                            "responseBuffer": {
                              "type": "string",
                              "format": "binary",
                              "readOnly": true,
                              "description": "Subrequest response body as a Buffer.",
                              "example": "AQID"
                            },
                            "responseText": {
                              "type": "string",
                              "readOnly": true,
                              "description": "Subrequest response body as a string.",
                              "example": "{\"result\":\"success\"}"
                            },
                            "rawHeadersIn": {
                              "type": "array",
                              "items": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "minItems": 2,
                                "maxItems": 2
                              },
                              "readOnly": true,
                              "description": "Raw incoming headers as an array of [name, value] pairs.",
                              "example": []
                            },
                            "rawHeadersOut": {
                              "type": "array",
                              "items": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "minItems": 2,
                                "maxItems": 2
                              },
                              "readOnly": true,
                              "description": "Raw outgoing headers as an array of [name, value] pairs.",
                              "example": []
                            },
                            "status": {
                              "type": "integer",
                              "description": "HTTP response status code (writable).",
                              "example": 200
                            },
                            "uri": {
                              "type": "string",
                              "readOnly": true,
                              "description": "Current URI of the request.",
                              "example": "/api/v1/resource"
                            },
                            "variables": {
                              "type": "object",
                              "additionalProperties": {
                                "type": "string"
                              },
                              "description": "NGINX variables object (writable for variables declared in config).",
                              "example": {}
                            },
                            "rawVariables": {
                              "type": "object",
                              "additionalProperties": {
                                "type": "string",
                                "format": "binary"
                              },
                              "description": "NGINX variables as Buffers (writable, since 0.5.0).",
                              "example": {}
                            },
                            "parent": {
                              "description": "Reference to the parent request object (for subrequests).",
                              "readOnly": true,
                              "allOf": [
                                {
                                  "type": "object",
                                  "description": "The HTTP request object (r) available in ngx_http_js_module handlers. Provides access to client request data and methods to produce a response.",
                                  "properties": {
                                    "args": {
                                      "type": "object",
                                      "additionalProperties": {
                                        "oneOf": [
                                          {
                                            "type": "string"
                                          },
                                          {
                                            "type": "array",
                                            "items": {
                                              "type": "string"
                                            }
                                          }
                                        ]
                                      },
                                      "readOnly": true,
                                      "description": "Request arguments object parsed from the query string. Duplicate keys are returned as arrays.",
                                      "example": {}
                                    },
                                    "headersIn": {
                                      "type": "object",
                                      "additionalProperties": {
                                        "type": "string"
                                      },
                                      "readOnly": true,
                                      "description": "Incoming request headers object.",
                                      "example": {}
                                    },
                                    "headersOut": {
                                      "type": "object",
                                      "additionalProperties": {
                                        "oneOf": [
                                          {
                                            "type": "string"
                                          },
                                          {
                                            "type": "array",
                                            "items": {
                                              "type": "string"
                                            }
                                          }
                                        ]
                                      },
                                      "description": "Outgoing response headers object (writable before headers are sent).",
                                      "example": {}
                                    },
                                    "httpVersion": {
                                      "type": "string",
                                      "readOnly": true,
                                      "description": "HTTP version of the request.",
                                      "example": "1.1"
                                    },
                                    "internal": {
                                      "type": "boolean",
                                      "readOnly": true,
                                      "description": "True if the request is to an internal location.",
                                      "example": false
                                    },
                                    "method": {
                                      "type": "string",
                                      "readOnly": true,
                                      "description": "HTTP method (GET, POST, etc.).",
                                      "example": "GET"
                                    },
                                    "remoteAddress": {
                                      "type": "string",
                                      "readOnly": true,
                                      "description": "Client IP address.",
                                      "example": "192.168.1.100"
                                    },
                                    "requestBuffer": {
                                      "type": "string",
                                      "format": "binary",
                                      "readOnly": true,
                                      "description": "Client request body as a Buffer (since 0.5.0).",
                                      "example": "AQID"
                                    },
                                    "requestText": {
                                      "type": "string",
                                      "readOnly": true,
                                      "description": "Client request body as a string.",
                                      "example": "{\"action\":\"process\"}"
                                    },
                                    "responseBuffer": {
                                      "type": "string",
                                      "format": "binary",
                                      "readOnly": true,
                                      "description": "Subrequest response body as a Buffer.",
                                      "example": "AQID"
                                    },
                                    "responseText": {
                                      "type": "string",
                                      "readOnly": true,
                                      "description": "Subrequest response body as a string.",
                                      "example": "{\"result\":\"success\"}"
                                    },
                                    "rawHeadersIn": {
                                      "type": "array",
                                      "items": {
                                        "type": "array",
                                        "items": {
                                          "type": "string"
                                        },
                                        "minItems": 2,
                                        "maxItems": 2
                                      },
                                      "readOnly": true,
                                      "description": "Raw incoming headers as an array of [name, value] pairs.",
                                      "example": []
                                    },
                                    "rawHeadersOut": {
                                      "type": "array",
                                      "items": {
                                        "type": "array",
                                        "items": {
                                          "type": "string"
                                        },
                                        "minItems": 2,
                                        "maxItems": 2
                                      },
                                      "readOnly": true,
                                      "description": "Raw outgoing headers as an array of [name, value] pairs.",
                                      "example": []
                                    },
                                    "status": {
                                      "type": "integer",
                                      "description": "HTTP response status code (writable).",
                                      "example": 200
                                    },
                                    "uri": {
                                      "type": "string",
                                      "readOnly": true,
                                      "description": "Current URI of the request.",
                                      "example": "/api/v1/resource"
        

# --- truncated at 32 KB (387 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/nginx/refs/heads/main/json-schema/njs-http-request-schema.json