【问题标题】:File upload returns undefined HTTP status文件上传返回未定义的 HTTP 状态
【发布时间】:2022-01-13 13:22:48
【问题描述】:

我有一个托管在 AKS 中的 Django / React 应用程序。 React 的构建由 Nginx 静态托管。 Nginx 容器通过 ClusterIP、Ingress 和 Nginx-Controller 公开。在这个应用程序中,我正在上传文件,但没有返回任何内容。不是错误,不是 HTTP 状态代码,什么都没有。这使得调试非常困难。这不会在本地发生,它只会发生在大于大约 10mb 的文件中。已经在nginx主机的default.conf中增加了client_max_body_size。在Controller docs 中找不到任何指示文件大小过大的内容,这也会导致 HTTP 413。有熟悉此问题的人吗?

在 React 中,我只是将 axiosformData 一起使用:

let formData = new FormData();
axios.post(`${API_SERVER}/builds`, formData).then(response => {
                console.log(response);
            }).catch(error => console.log(error));

HTTP 响应:

undefined undefined undefined
date: Wed, 08 Dec 2021 15:27:35 GMT
content-type: text/html
content-length: 176
strict-transport-security: max-age=15724800; includeSubDomains
X-Firefox-Spdy: h2

【问题讨论】:

    标签: reactjs django nginx azure-aks


    【解决方案1】:

    原来Nginx-Controller 中有一个最大体型。你可以用注解nginx.ingress.kubernetes.io/proxy-body-size来改变它。

    【讨论】:

      猜你喜欢
      • 2021-09-01
      • 1970-01-01
      • 2019-05-30
      • 2020-08-20
      • 1970-01-01
      • 1970-01-01
      • 2015-03-26
      • 1970-01-01
      • 2018-08-26
      相关资源
      最近更新 更多