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
- Source code for nginx. I have tested this module with nginx version 0.5.24.
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
- There is a hard limit on the size of the notice that this module will send, by default 100KiB. You can change the limit by editing the source file.
- This module does not log errors.
Changes
June 21, 2007
- Bug fix: close the notice file after reading it.
June 12, 2007
- Initial release