Instantly share code, notes, and snippets.

Embed
What would you like to do?
http {
log_format mylogfmt '$remote_addr - $remote_user [$time_local] \
"$request" $status $body_bytes_sent "$http_referer" \
"$http_user_agent" "$foo"'
}
location / {
proxy_pass http://remote-server.example.com/;
proxy_set_header X-Real-IP $remote_addr;
proxy_connect_timeout 150;
proxy_send_timeout 100;
proxy_read_timeout 100;
proxy_buffers 4 32k;
client_max_body_size 8m;
client_body_buffer_size 128k;
rewrite_by_lua '
cjson = require "cjson"
ngx.req.read_body()
body_table = cjson.decode(ngx.var.request_body)
ngx.var.foo = body_table["foo"]
';
access_log /var/log/nginx/access.log mylogfmt;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment