I am writing a Spring controller that processes an HTTP PUT request from a client and generates a pre-signed S3 URL and issues HTTP code 307 (tempo redirect). So basically I authenticate the client, and if he succeeds, I ask him to write the s3 folder. The client can write in the signed location URL.
Now I'm worried that the client will have to do the download twice. Once to my application server, and then to s3, so the operation will take twice the time.
As far as I understand, is the client actually making 2 entries in this case? Or is the client smart enough and just pushes part of the payload first, and if he succeeds, then pushes the whole payload?
I read about the status of the HTTP 100 code, but it looks like the application server / tomcat already issues it and is not in my control.
Here is my spring controller
@RequestMapping("/upload") public ResponseEntity<Void> execute(HttpServletRequest request) throws IOException, ServletException { HttpHeaders headers = new HttpHeaders(); String redirectUrl = getRedirectUrl(requestURI, request.getMethod()); headers.setLocation(new URI(redirectUrl)); ResponseEntity<Void> redirectEntity = new ResponseEntity<Void>(null,headers,HttpStatus.TEMPORARY_REDIRECT); return redirectEntity; }
How can I prevent a client from downloading all the payload to the application server?
source share