Nginx 直接返回json
作者:Bright Xu
location /ip {
default_type application/json;
add_header Access-Control-Allow-Credentials true;
add_header Access-Control-Allow-Origin *;
add_header Cache-Control public;
add_header Cache-Control max-age=300;
return 200 '{"code":$status,"ip":"$remote_addr","User-Agent":"$http_user_agent"}';
}