Skip to content

Instantly share code, notes, and snippets.

@kbartek kbartek/jsonip Secret
Created Feb 12, 2013

Embed
What would you like to do?
server {
listen 80;
gzip on;
gzip_vary on;
gzip_types application/json;
add_header Access-Control-Allow-Methods GET;
add_header Access-Control-Allow-Origin *;
default_type application/json;
location = "/about" {
return 200 '{"About":"Inspired by jsonip.com"}';
}
location ~ ^/(.+)$ {
return 200 '$1({"ip":"$remote_addr","about":"/about"})';
}
location / {
if ($arg_callback != "") {
rewrite ^ /$arg_callback last;
}
return 200 '{"ip":"$remote_addr","about":"/about"}';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.