How do I send or set arbitrary HTTP headers using the Nginx web server at Brixly?

You need to use the add_header directive. It sends arbitrary HTTP header when the response code is equal to 200, 204, 301, 302 or 304. 

The following lines can be added directly to your nginx.conf file (located in the public_html)

add_header name value

In this example, set X-Whom to www-node01:

add_header X-Whom www-node01

How Do I Test It?

Simply use curl as follows:

$ curl -I

Sample outputs:

HTTP/1.1 200 OK Server: nginx Date: Mon, 15 Mar 2010 10:40:58 GMT Content-Type: text/html; charset=ISO-8859-1 Connection: keep-alive X-Whom: www-node01
Was this article helpful?
Thank you!