It's exactly as the error message explains – you're doing an "early response", which not all HTTP Clients can survive. Akka's HTTP client would survive it, but blocking APIs often wouldn't.
The thing is that you write the response `complete(OK)` before the incoming data has finished streaming. To avoid doing an early response, you should complete with a response only once the upload has finished: val completesOnceUploadCompleted: Future[Done] = r.entity.withoutSizeLimit.dataBytes.runWith(Sink.ignore) val futureResponseBody = completesOnceUploadCompleted.map(_ => "OK!") complete(futureResponseBody) Hope this helps, happy hakking! Would be great if we'd explain this in the docs too btw – would you be up to contributing a docs example about it? -- Konrad `ktoso` Malawski Akka @ Lightbend On 12 May 2016 at 17:05:24, Qux (angizi...@gmail.com) wrote: Hi, I wanted to try a HTTP-Upload (like at the end of https://www.youtube.com/watch?v=DEQtNuhCW8g). You can see the Code at the end. When I try to Upload a big file (for example on linux: curl -T /dev/zero http://localhost:18080/upload > /dev/null ), I get following: [WARN] [05/12/2016 16:56:15.708] [Demo-akka.actor.default-dispatcher-7] [akka.actor.ActorSystemImpl(Demo)] Sending 2xx response before end of request was received... Note that the connection will be closed after this response. Also, many clients will not read early responses! Consider waiting for the request end before dispatching this response! With small files, everything is ok, so I think it has something to do with Multipart-Messages or so. Can someone help me, so that the upload works also for bigger files? Thanks, Qux import java.io.File import akka.actor.ActorSystem import akka.http.scaladsl.{Http, server} import akka.http.scaladsl.model._ import akka.http.scaladsl.server.Directives._ import akka.stream.ActorMaterializer import akka.stream.scaladsl.{FileIO, Flow, Sink} import akka.util.{ByteString, Timeout} import akka.pattern._ import scala.concurrent.Future import scala.concurrent.duration._ import scala.io.StdIn object HTTP extends App { implicit val sys = ActorSystem("Demo") implicit val mat = ActorMaterializer() implicit val timeout = Timeout(3.seconds) implicit val executionContext = sys.dispatcher val route = path("upload") { extractRequest { req => req.entity.withoutSizeLimit().dataBytes.to(Sink.ignore).run() complete(StatusCodes.OK) } } } val bindingFuture = Http().bindAndHandle(route, "localhost", 8080) println(s"Server online at http://localhost:8080/\nPress RETURN to stop...") StdIn.readLine() // let it run until user presses return bindingFuture .flatMap(_.unbind()) // trigger unbinding from the port .onComplete(_ ⇒ sys.terminate()) // and shutdown when done -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout. -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.