telize

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

commit 86c7cfdc325d6da79a84ba9d3eb52320d831c5e3
parent 8ce7d96ef200567579838d598cb8d59e0c16b782
Author: Frederic Cambus <fcambus@users.sourceforge.net>
Date:   Sun, 31 Aug 2014 15:19:48 +0200

Introducing configuration variables for CORS

Diffstat:
Mtelize | 15+++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/telize b/telize @@ -4,7 +4,7 @@ # http://www.telize.com # # # # Created: 2013/08/15 # -# Last Updated: 2014/07/18 # +# Last Updated: 2014/08/31 # # # # Telize is released under the BSD 3-Clause license. # # See LICENSE file for details. # @@ -12,6 +12,10 @@ ############################################################################### server { + # Configuration variables + set $cors "true"; + set $cors_origin "*"; + server_name 127.0.0.1; # Uncomment when using Telize behind a load balancer @@ -61,9 +65,6 @@ server { location /jsonify { access_log off; - add_header Access-Control-Allow-Origin *; - add_header Cache-Control no-cache; - charset utf-8; default_type application/json; @@ -72,6 +73,12 @@ server { set $isp $2; } + if ($cors = "true") { + 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")