当前位置: 首页 > 工具软件 > NGINXConfig > 使用案例 >

Reply with 200 from Nginx config without serving a file

宫亦
2023-12-01

参考:http://serverfault.com/questions/196929/reply-with-200-from-nginx-config-without-serving-a-file

用nginx返回200,外加一行字符串,会被当成文件下载,如果不想这样,可以使用这样的配置。

location / {
    return 200 'gangnam style!';
    # because default content-type is application/octet-stream,
    # browser will offer to "save the file"...
    # if you want to see reply in browser, uncomment next line 
    # add_header Content-Type text/plain;
}

location / {
    return 200 'your json string'; 
    add_header Content-Type text/plain;
}
 类似资料:

相关阅读

相关文章

相关问答