matsumoto-r/ngx_mruby — pull request #63 by cubicdaiya (2013-07-24 17:02:26+00:00)
Title: header and body filter implementations

## config

```nginx
server {
listen 8000;
server_name localhost;
root html;

location / {
mruby_header_filter_code "
r = Nginx::Request.new()
r.content_type = 'image/png'
";
mruby_body_filter_code "
'[' + ARGV[0] + ']'
";
}
}
```

## index.html

```html

Welcome to nginx!

Welcome to nginx!!!

```

## example

```zsh
$ curl "http://localhost:8000/index.html"
[

Welcome to nginx!

Welcome to nginx!!!

]
$ curl -I "http://localhost:8000/index.html"
HTTP/1.1 200 OK
Server: nginx/1.5.3
Date: Wed, 24 Jul 2013 16:59:32 GMT
Content-Type: image/png
Content-Length: 155
Last-Modified: Wed, 21 Mar 2012 05:26:56 GMT
Connection: keep-alive
ETag: "4f6966a0-99"
Accept-Ranges: bytes

$
```