telize

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

commit 4febf6ab0ecf663595af42524fc010e094a11196
parent 6a17ac399eaf4719ea0dd18926ee61e8fdf58b8c
Author: Frederic Cambus <fred@statdns.com>
Date:   Mon, 24 Oct 2016 16:29:17 +0200

Use Lua to set additional headers and drop dependency on the 'ngx_headers_more' module

Diffstat:
MREADME.md | 1-
MTODO | 1-
Mtelize | 6+++---
3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md @@ -32,7 +32,6 @@ Telize requires Nginx 1.7.4+ compiled with the following modules : - HttpRealipModule (Optional HTTP module : --with-http_realip_module) - HttpEchoModule (Third party module (ngx_echo) : http://wiki.nginx.org/HttpEchoModule) - HttpLuaModule (Third party module (ngx_lua) : http://wiki.nginx.org/HttpLuaModule) -- HttpHeadersMoreModule (Third party module (ngx_headers_more) : http://wiki.nginx.org/HttpHeadersMoreModule) If you are using Debian stable, the `nginx-extras` package have these modules compiled-in. diff --git a/TODO b/TODO @@ -2,4 +2,3 @@ - Force UTF-8 encoding of GeoIP variables directly in Nginx to drop dependency on Lua iconv module - Use 'content_by_lua_block' directive instead of 'content_by_lua' -- Use Lua to set additional headers? diff --git a/telize b/telize @@ -5,7 +5,7 @@ # http://www.telize.com # # # # Created: 2013-08-15 # -# Last Updated: 2016-07-18 # +# Last Updated: 2016-10-24 # # # # Telize is released under the BSD 2-Clause license. # # See LICENSE file for details. # @@ -82,13 +82,13 @@ server { add_header Access-Control-Allow-Origin $cors_origin; } - more_set_headers "Cache-Control: no-cache"; - content_by_lua ' local cjson = require("cjson") local iconv = require("iconv") local cd = iconv.new("utf-8","iso-8859-15") + ngx.header["Cache-Control"] = "no-cache"; + -- Check for invalid IP addresses if ngx.var.remote_addr == "127.0.0.1" then ngx.status = ngx.HTTP_BAD_REQUEST