ajp_ignore_headers

The `ajp_ignore_headers` directive specifies which AJP response headers should be ignored by NGINX when proxying requests to an AJP backend.

Syntaxajp_ignore_headers header_name1 header_name2;
Defaultnone
Contexthttp, server, location
Arguments1+

Description

The ajp_ignore_headers directive is used in the context of NGINX configuration to manage the handling of specific response headers received from an AJP (Apache JServ Protocol) server. When NGINX acts as a reverse proxy to an AJP backend, it may receive various headers that might not be relevant or desired in the client response. This directive allows administrators to specify one or more headers that should be omitted from the responses forwarded to the client.

The directive accepts one or more arguments, each representing a specific header name that should be ignored. This can be useful for eliminating redundant headers or sensitive information that should not be exposed to the end user. By carefully selecting which headers to ignore, server performance can also be enhanced, as less data is sent over the network.

When specifying the headers, it is crucial to use the exact case-sensitive names as they appear in the HTTP response. Failure to do so may result in unintended headers being passed to the client. This directive can be particularly powerful in configurations where multiple backends are used, enabling fine-tuned control over the information that is made available to clients.

Config Example

http {
    upstream tomcats {
        server 127.0.0.1:8009;
        keepalive 10;
    }

    server {
        listen 80;

        location / {
            ajp_pass tomcats;
            ajp_ignore_headers "Set-Cookie" "X-Powered-By";
        }
    }
}

Ensure that the header names are case-sensitive and match exactly as they appear in the response from the AJP server.

Using this directive without understanding the consequences may result in loss of important information in responses sent to clients.

← Back to all directives