如何使用精简配置自定义 400 响应



我在rails应用程序中使用thin作为我的Web服务器。当试图点击一个 url 时,http://localhost:3000/search/% 的薄正在抛出

 Invalid request: Invalid HTTP format, parsing fails.

如何使用编写自定义 400 响应处理程序?

按如下方式更新nginx配置文件,并在公用文件夹中创建400.html文件。

server { listen 80;
root /public;   # <--- be sure to point to 'public'!
error_page 400 /400.html;
location = /400.html {
internal;
}
location / {
return 400;
}
}

最新更新