telize

High performance JSON IP and GeoIP REST API (IP Geolocation)
Log | Files | Refs | README | LICENSE

commit 55a3d922ab865be0c4a2a8d27d5e36d1907e7db1
parent 6532859ccf0f6319852026f354a235ee0d93be40
Author: Frederic Cambus <fcambus@users.sourceforge.net>
Date:   Mon, 26 Oct 2015 16:58:10 +0100

The 'jsonip' endpoint do not use the internal 'jsonify' endpoint anymore

Diffstat:
Mtelize | 18+++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/telize b/telize @@ -37,7 +37,23 @@ server { } location ~ /jsonip$ { - echo_exec /jsonify ip=$remote_addr&callback=$arg_callback; + charset utf-8; + default_type application/json; + + content_by_lua ' + local cjson = require("cjson") + + local json = cjson.encode({ + ip = ngx.var.remote_addr + }) + + local callback = ngx.var.arg_callback + + if callback then + ngx.say(callback, "(", json, ");") + else + ngx.say(json) + end'; } location ~ /geoip/?(?<ip>.*) {