1. 程式人生 > 其它 >紀錄一次奇怪的bug,請求路徑超長,介面訪問不通

紀錄一次奇怪的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請求,用請求體傳參