<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Read the docs please :)<br><br><a href="http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#set">http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#set</a></div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">Set is allowed is server, location, and if blocks. Not http blocks. </div><div><br>On Apr 25, 2017, at 12:41, Joel Parker <<a href="mailto:joel.parker.gm@gmail.com">joel.parker.gm@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div>I have a set directive inside an http block which I thought was valid but when I run config -t it says the nginx: [emerg] "set" directive is not allowed here.<br><br><br>http {<br><br>    log_format bodylog '$remote_addr - $remote_user [$time_local] '<br>      '"$request" $status $body_bytes_sent '<br>      '"$http_referer" "$http_user_agent" $request_time '<br>      '<"$request_body" >"$resp_body"';<br><br>     lua_need_request_body on;<br><br>     <b>set $resp_body "";</b><br>     body_filter_by_lua '<br>        local resp_body = ngx.arg[1]<br>        ngx.ctx.buffered = (ngx.ctx.buffered or "") .. resp_body<br>        if ngx.arg[2] then<br>           ngx.var.resp_body = ngx.ctx.buffered<br>        end<br>       ';<br><br>.....<br><br></div>Joel<br><div><br></div></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>nginx mailing list</span><br><span><a href="mailto:nginx@nginx.org">nginx@nginx.org</a></span><br><span><a href="http://mailman.nginx.org/mailman/listinfo/nginx">http://mailman.nginx.org/mailman/listinfo/nginx</a></span></div></blockquote></body></html>