【问题标题】:file upload zuul proxy request size issue文件上传zuul代理请求大小问题
【发布时间】:2020-04-02 02:37:45
【问题描述】:

我的 zuul 代理有问题,它与请求的大小有关,我总是收到 500 错误连接已在响应之前关闭。

控制器代码:

@RestController
@RequestMapping("/file")
public class FileController {

    @PostMapping("/upload")
    public ResponseEntity<String> uploadFile(@RequestParam("file") MultipartFile file) throws Exception {

        System.out.println("File Name : " + file.getOriginalFilename(),
            "File Size : " + file.getSize() + "bytes");

        return ResponseEntity.ok(file.getName() + " uploaded");
    }

}

有什么想法吗?

【问题讨论】:

  • 您是否尝试过使用断点进行调试?它是在打印文件名之后还是之前中断?

标签: java spring spring-boot netflix-zuul


【解决方案1】:

您的问题在于色带插座的尺寸。 尝试将此属性添加到您的 getway 属性文件 - 您启用 zuul 代理的那个文件 - :

ribbon.eager-load.enabled=true
hystrix.command.default.execution.timeout.enabled=false
hystrix.command.default.execution.isolation.strategy=THREAD

hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=3999996
ribbon.ConnectTimeout=999999
ribbon.ReadTimeout=999999
ribbon.SocketTimeout=999999
zuul.host.socket-timeout-millis=999999
zuul.host.connect-timeout-millis=999999
zuul.sensitiveHeaders=Cookie,Set-Cookie

【讨论】:

  • 我将它添加到我的应用程序属性中,但我遇到了同样的问题
  • 您是在 MS 服务属性文件还是在 MS getway 属性文件中添加的?
猜你喜欢
  • 2013-05-07
  • 2014-08-09
  • 2011-04-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-09-08
  • 2018-08-25
相关资源
最近更新 更多