telize

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

commit 115ef4d7460ed636bd56f67d32005a022e5fe90a
parent de91ec01256febeb39361344cd7348e2776fc022
Author: Frederic Cambus <fred@statdns.com>
Date:   Wed,  7 Mar 2018 22:36:55 +0100

Shuffle some code around, for consistency

Diffstat:
Mtelize.conf | 14+++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/telize.conf b/telize.conf @@ -29,11 +29,11 @@ server { gzip off; location ~ /ip$ { - add_header Cache-Control no-cache; - charset off; default_type text/plain; + add_header Cache-Control no-cache; + content_by_lua_block { ngx.say(ngx.var.remote_addr) } @@ -79,13 +79,13 @@ server { } location /jsonify { + charset utf-8; + default_type application/json; + set_real_ip_from 127.0.0.1; access_log off; - charset utf-8; - default_type application/json; - if ($cors = "true") { add_header Access-Control-Allow-Origin $cors_origin; } @@ -123,8 +123,6 @@ server { organization = ngx.var.geoip2_organization, } - local callback = ngx.var.arg_callback - -- Validate payload for item, value in pairs(payload) do if payload[item] == "" then @@ -150,6 +148,8 @@ server { local json = cjson.encode(payload) + local callback = ngx.var.arg_callback + if callback ~= "" then ngx.say(callback, "(", json, ");") else