Nginx-notice

Nginx-notice is an nginx module designed to ignore the usual semantics of HTTP methods POST and PUT, treating those requests as if they were GET requests and returning a fixed response body regardless of the request URI. It's intended to display notices of downtime to agents that sent POST requests even when they shouldn't, such as the Facebook platform canvas page callbacks. This module was originally written for the Causes on Facebook application.

Requirements

Download

Nginx-notice is distributed under the same license as nginx itself.

Download nginx-notice release 2 (3253 bytes) and try it out. Instructions are included in the source package. You should be comfortable compiling nginx from source in order to find this module useful.

Source Code

There is a git repository at http://xph.us/src/nginx-notice.git/.

Configuration

Once the module is installed, you will have two new configuration directives.

Example Configuration

server {
    if (-f /path/to/notice.txt) {
        rewrite ^(.*)$ /notice.txt;
        break;
    }

    location = /notice.txt {
        notice /path/to/notice.txt;
        notice_type text/plain;
        break;
    }
}

Directive: notice

syntax
notice path
default
None
context
location

Enables display of the maintenance notice for this location.

Directive: notice_type

syntax
notice_type type
default
text/html
context
location

Sets the content-type of the notice for this location.

Bugs

Changes

June 21, 2007

June 12, 2007