Search code examples
javaspringspring-bootnetflix-zuul

file upload zuul proxy request size issue


i have a probleme with zuul proxy, it's about the size of the request, i always getting 500 error Connection has being closed before response.

controller code :

@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");
    }

}

Any idea?


Solution

  • Your problem here is with the ribbon socket size. Try to add this properties to your getway properties file -- the one where you enabled zuul proxy -- :

    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