Accept cookies for analytics, social media, and advertising, or learn more and adjust your preferences. These cookies are on by default for visitors outside the UK and EEA. Privacy Notice.
These constants are an easy way to reference the HTTP return codes in your modules
Option | Value |
---|---|
NGX_HTTP_CONTINUE |
100 |
NGX_HTTP_SWITCHING_PROTOCOLS |
101 |
NGX_HTTP_PROCESSING |
102 |
NGX_HTTP_OK |
200 |
NGX_HTTP_CREATED |
201 |
NGX_HTTP_ACCEPTED |
202 |
NGX_HTTP_NO_CONTENT |
204 |
NGX_HTTP_PARTIAL_CONTENT |
206 |
NGX_HTTP_SPECIAL_RESPONSE |
300 |
NGX_HTTP_MOVED_PERMANENTLY |
301 |
NGX_HTTP_MOVED_TEMPORARILY |
302 |
NGX_HTTP_SEE_OTHER |
303 |
NGX_HTTP_NOT_MODIFIED |
304 |
NGX_HTTP_TEMPORARY_REDIRECT |
307 |
NGX_HTTP_BAD_REQUEST |
400 |
NGX_HTTP_UNAUTHORIZED |
401 |
NGX_HTTP_FORBIDDEN |
403 |
NGX_HTTP_NOT_FOUND |
404 |
NGX_HTTP_NOT_ALLOWED |
405 |
NGX_HTTP_REQUEST_TIME_OUT |
408 |
NGX_HTTP_CONFLICT |
409 |
NGX_HTTP_LENGTH_REQUIRED |
411 |
NGX_HTTP_PRECONDITION_FAILED |
412 |
NGX_HTTP_REQUEST_ENTITY_TOO_LARGE |
413 |
NGX_HTTP_REQUEST_URI_TOO_LARGE |
414 |
NGX_HTTP_UNSUPPORTED_MEDIA_TYPE |
415 |
NGX_HTTP_RANGE_NOT_SATISFIABLE |
416 |
NGX_HTTP_TOO_MANY_REQUESTS |
429 |
NGX_HTTP_CLOSE |
444 |
NGX_HTTP_NGINX_CODES |
494 |
NGX_HTTP_REQUEST_HEADER_TOO_LARGE |
494 |
NGX_HTTPS_CERT_ERROR |
495 |
NGX_HTTPS_NO_CERT |
496 |
NGX_HTTP_TO_HTTPS |
497 |
NGX_HTTP_CLIENT_CLOSED_REQUEST |
499 |
NGX_HTTP_INTERNAL_SERVER_ERROR |
500 |
NGX_HTTP_NOT_IMPLEMENTED |
501 |
NGX_HTTP_BAD_GATEWAY |
502 |
NGX_HTTP_SERVICE_UNAVAILABLE |
503 |
NGX_HTTP_GATEWAY_TIME_OUT |
504 |
NGX_HTTP_INSUFFICIENT_STORAGE |
507 |
ngx_http_request_t
¶A structure containing the details of a request and response. There are many members of this structure so only the parts you would be expected to use are listed here
connection
¶The connection object for the structure. Useful for its log
member.
upstream
¶An object to set details for an upstream request
pool
¶The memory pool to use for allocations with the request
headers_in
¶An object containing the http headers that came in with the request
headers_out
¶An object containing the http headers to be returned to the client
main
¶A pointer to the main request, points to its own structure if it is the main request
parent
¶A pointer to the parent request
header_only:1
¶Set to 1
to disable sending the body to a client
ngx_http_headers_in_t
¶A structure to store the incoming header data
headers
¶A list containing the incoming headers
host
¶The host header
connection
¶Desired connection options (such as close
and keep-alive
)
if_modified_since
¶The If-Modified-Since
incoming header
if_unmodified_since
¶The If-Unmodified-Since
incoming header
if_match
¶The If-Match
incoming header
if_none_match
¶The If-None-Match
incoming header
user_agent
¶The client’s user agent
referer
¶The referer supplied by the client
content_length
¶The content length of client POST data
content_type
¶The content type of client POST data
range
¶The requested byte range for the content
if_range
¶The If-Range
incoming header
transfer_encoding
¶The encoding for the data transfer
expect
¶The Expect
incoming header
upgrade
¶The connection upgrade request from the client
accept_encoding
¶The encodings the client will accept
via
¶Details of the proxy used by the client
The autorization request header
keep_alive
¶The client keep-alive request header
x_forwarded_for
¶The X-Forwarded-For
header for a load balancer
x_real_ip
¶The X-Real-IP
header for a load balanacer
accept
¶The content types which are acceptable for a response
accept_language
¶The acceptable human languages to be used for a response
depth
¶The Depth
incoming header
destination
¶The Destination
incoming header
overwrite
¶The Overwrite
incoming header
date
¶The client date/time of the request
An array containting the incoming cookies
content_length_n
¶The length of the incoming content
keep_alive_n
¶The keep alive timeout time
connection_type:2
¶A flag stating whether the connection is NGX_HTTP_CONNECTION_KEEP_ALIVE
or NGX_HTTP_CONNECTION_CLOSE
chunked:1
¶A boolean specifying chunked encoding
msie:1
¶A boolean specifying Internet Explorer as the client
msie6:1
¶A boolean specifying Internet Explorer 6 as the client
opera:1
¶A boolean specifying Opera as the client
gecko:1
¶A boolean specifying the Gecko rendering engine as the client (ie. Firefox)
chrome:1
¶A boolean specifying Chrome as the client
safari:1
¶A boolean specifying Safari as the client
konqueror:1
¶A boolean specifying Konqueror as the client
ngx_http_headers_out_t
¶A structure to store the outgoing header data
headers
¶A list containing additional headers to be added
status
¶The status to return, possible options are the HTTP Return Codes
content_encoding
¶Stores the “Content-Encoding” header, both key and value.
content_type_len
¶The length of the content type, normally this should be set to the same as content_type.len
content_length_n
¶The length of the content body
last_modified_time
¶The last modified time for the returned content
ngx_http_upstream_t
¶peer
¶Connection details for the upstream peer.
conf
¶A pointer to the configuration object for the upstream.
(*create_request)
(ngx_http_request_t *r)¶A callback function which should allocate the required buffers for a request. It should return NGX_OK
on success or NGX_ERROR
on failure.
(*reinit_request)
(ngx_http_request_t *r)¶A callback to reinitialize a state pointers if an attempt to communicate with an upstream fails. It should return NGX_OK
on success.
(*process_header)
(ngx_http_request_t *r)¶A callback to set the header for the client response after the upstream header has been retrieved. It should return NGX_OK
on success.
(*abort_request)
(ngx_http_request_t *r)¶A callback triggered when the client aborts a request.
(*finalize_request)
(ngx_http_request_t *r, ngx_int_t rc)¶A callback triggered to finish the request.
ngx_http_upstream_conf_t
¶An upstream configuration object used for upstream/proxy handlers
connect_timeout
¶The connect timeout for the upstream
send_timeout
¶The send timeout for the upstream
read_timeout
¶The read timeout for the upstream
next_upstream_timeout
¶Timeout before switching to the next upstream
store_access
¶Permissions for storing files such as temporary files to disk
bufs
¶Buffers for the upstream body data
buffering
¶Whether or not to buffer the data
buffer_size
¶The size of each buffer, it should normally be set to ngx_pagesize
max_temp_file_size
¶The maximum size of temporary files
temp_file_write_size
¶The amount of data before the body should be stored to disk
hide_headers
¶A list of header fields to not pass downstream
pass_headers
¶A list of header fields to pass downstream that are normally disabled. These are: “Date”, “Server”, “X-Pad”, and “X-Accel-…”
ngx_http_subrequest
(ngx_http_request_t *r, ngx_str_t *uri, ngx_str_t *args, ngx_http_request_t **sr, ngx_http_post_subrequest_t *psr, ngx_uint_t flags)¶Executes a subrequest to a given URL
Parameters: |
|
---|---|
Returns: |
|
ngx_http_get_module_ctx
(ngx_http_request_t *r, ngx_module_t module)¶A macro to get the context data for a given module and request
Parameters: |
|
---|---|
Returns: | A pointer to the context |
ngx_http_set_ctx
(ngx_http_request_t *r, void *c, ngx_module_t module)¶A macro to set the context data for a given module and request
Parameters: |
|
---|
(*ngx_http_output_header_filter+pt)
(ngx_http_request_t *r)¶A callback to a header filter. In modules this is normally used as follows:
static ngx_http_output_header_filter_pt ngx_http_next_header_filter;
(*ngx_http_output_body_filter_pt)
(ngx_http_request_t *r, ngx_chain_t *chain)¶A callback to a body filter. In modules this is normally used as follows:
static ngx_http_output_body_filter_pt ngx_http_next_body_filter;