Note that as of 0.8.17 no contents will be added if the current location is served as a subrequest itself. Consider the following example:
location /foo { add_before_body /bar; } location /bar { add_before_body /baz; }
Then accessing /foo won't get /baz inserted before the contents of the subrequest /bar.
Also note that at this time, only strings can be used in before/after body locations, not variables. So
location / { set $before_action /before_action; add_before_body $before_action; }
will not work as expected (although the configuration file will still load properly).