纪录一次奇怪的bug,请求路径超长,接口访问不通


前提

nginx + docker + uwsgi + django 部署服务

问题:

当GET请求, 请求路径超长时,nginx转发不成功

请求路径为

http://{server_ip}/report/get_bw/?page_num=1&page_size=3&locations=%E4%BC%8A%E6%8B%89%E5%85%8B&locations=%E4%BF%84%E7%BD%97%E6%96%AF&locations=%E6%97%A5%E6%9C%AC&locations=%E9%A9%AC%E5%85%B6%E9%A1%BF&locations=%E5%B7%B4%E6%9E%97&locations=%E9%98%BF%E5%B0%94%E5%8F%8A%E5%88%A9%E4%BA%9A&locations=%E6%B3%95%E5%9B%BD&locations=%E5%8A%A0%E6%B2%99%E5%9C%B0%E5%B8%A6&locations=%E5%8D%B0%E5%BA%A6&locations=%E5%B7%B4%E5%8B%92%E6%96%AF%E5%9D%A6&locations=%E5%A2%A8%E8%A5%BF%E5%93%A5&locations=%E6%91%A9%E7%BA%B3%E5%93%A5&locations=%E9%9F%A9%E5%9B%BD&locations=%E4%B9%94%E6%B2%BB%E4%BA%9A%E5%B7%9E&locations=%E4%B8%AD%E5%9B%BD&locations=%E5%93%88%E8%90%A8%E5%85%8B&locations=%E5%A1%9E%E6%B5%A6%E8%B7%AF%E6%96%AF&locations=%E7%A7%91%E5%A8%81%E7%89%B9&locations=%E7%99%BE%E6%85%95%E5%A4%A7%E7%BE%A4%E5%B2%9B&locations=%E4%BA%9A%E7%BE%8E%E5%B0%BC%E4%BA%9A%E5%85%B1&locations=%E5%9C%9F%E5%BA%93%E6%9B%BC%E6%96%AF%E5%9D%A6&locations=%E7%BE%8E%E5%9B%BD&locations=%E8%A5%BF%E7%8F%AD%E7%89%99&locations=%E7%A7%91%E7%B4%A2%E6%B2%83&locations=%E7%BD%97%E9%A9%AC%E5%B0%BC%E4%BA%9A&locations=%E5%90%89%E5%B0%94%E5%90%89%E6%96%AF%E6%96%AF%E5%9D%A6&locations=%E6%91%A9%E6%B4%9B%E5%93%A5&locations=%E6%84%8F%E5%A4%A7%E5%88%A9&locations=%E4%BC%8A%E6%9C%97&locations=%E6%A2%B5%E8%92%82%E5%86%88&locations=%E9%98%BF%E5%AF%8C%E6%B1%97&locations=%E6%9C%9D%E9%B2%9C&locations=%E5%88%A9%E6%AF%94%E4%BA%9A&locations=%E9%98%BF%E5%B0%94%E5%B7%B4%E5%B0%BC%E4%BA%9A&locations=%E5%8A%A0%E6%8B%BF%E5%A4%A7&locations=%E6%B3%A2%E9%BB%91&locations=%E5%8F%99%E5%88%A9%E4%BA%9A&locations=%E9%98%BF%E5%A1%9E%E6%8B%9C%E7%96%86&locations=%E4%B9%8C%E5%85%B9%E5%88%AB%E5%85%8B&locations=%E5%AE%89%E9%81%93%E5%B0%94&locations=%E4%BB%A5%E8%89%B2%E5%88%97&locations=%E7%AA%81%E5%B0%BC%E6%96%AF&locations=%E8%A5%BF%E5%B2%B8&locations=%E5%B0%BC%E6%B3%8A%E5%B0%94&locations=%E9%BB%91%E5%B1%B1&locations=%E5%9C%9F%E8%80%B3%E5%85%B6&locations=%E5%B7%B4%E5%9F%BA%E6%96%AF%E5%9D%A6&locations=%E7%BA%A6%E6%97%A6&locations=%E6%A0%BC%E9%B2%81%E5%90%89%E4%BA%9A&locations=%E9%A9%AC%E8%80%B3%E4%BB%96&locations=%E5%AE%89%E6%8F%90%E7%93%9C%E5%92%8C%E5%B7%B4%E5%B8%83%E8%BE%BE&locations=%E5%93%88%E8%90%A8%E5%85%8B%E6%96%AF%E5%9D%A6&locations=%E6%99%BA%E5%88%A9&locations=%E5%A1%9E%E5%B0%94%E7%BB%B4%E4%BA%9A&locations=%E8%8B%B1%E5%9B%BD&locations=%E5%90%89%E5%B0%94%E5%90%89%E6%96%AF&locations=%E5%B8%8C%E8%85%8A&locations=%E9%BB%8E%E5%B7%B4%E5%AB%A9&locations=%E6%B3%A2%E6%96%AF%E5%B0%BC%E4%BA%9A%E5%92%8C%E9%BB%91%E5%A1%9E%E5%93%A5%E7%BB%B4%E9%82%A3&locations=%E4%B9%8C%E5%85%B9%E5%88%AB%E5%85%8B%E6%96%AF%E5%9D%A6&locations=%E8%A5%BF%E6%92%92%E5%93%88%E6%8B%89&locations=%E4%BF%9D%E5%8A%A0%E5%88%A9%E4%BA%9A&locations=%E5%9C%A3%E9%A9%AC%E5%8A%9B%E8%AF%BA&locations=%E5%9F%83%E5%8F%8A&locations=%E9%97%A8%E7%9A%84%E5%86%85%E5%93%A5%E7%BD%97&locations=%E5%A1%94%E5%90%89%E5%85%8B%E6%96%AF%E5%9D%A6&locations=%E8%91%A1%E8%90%84%E7%89%99

页面报如下错误

An error occurred.
Sorry, the page you are looking for is currently unavailable.
Please try again later.

If you are the system administrator of this resource then you should check the error log for details.

Faithfully yours, nginx.

其他接口访问正常
django服务器接收不到请求

解决方案

  • 修正方式1:
    uwsgi.ini中加一行配置

buffer-size = 65536

重启服务后,正常访问接口

  • 修正方式2:
    可将接口修改为POST请求,用请求体传参


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM