I try to increase the max-content-length so that large files can be uploaded to the server.
I have added this to application.conf
spray.can {
server {
parsing {
max-content-length = 2g
max-chunk-size = 10m
}
}
}
However the cap seems to still be at 1MB. I can confirm that the parameters are read, as I can lower the cap and it will take effect.
The application triggers a response error (413 Request Entity Too Large
), I have a HttpService (accepting CORS) and a route looking like this:
val contentRoute =
cors {
pathPrefix(PROJECTS) {
(post & path(Segment / CONTENT)) { (projectId) =>
post {
entity(as[MultipartFormData]) { data =>
complete(StatusCodes.OK)
}
}
}
}
}
Could there be some other preference that I also need to adjust, that is also set to 1MB by default?
Update:
These are the dependency versions:
libraryDependencies ++= {
val akkaV = "2.3.9"
val sprayV = "1.3.3"
Seq(
"io.spray" %% "spray-can" % sprayV,
"io.spray" %% "spray-routing" % sprayV,
"io.spray" %% "spray-json" % "1.3.2",
"io.spray" %% "spray-testkit" % sprayV % "test",
"com.typesafe.akka" %% "akka-actor" % akkaV,
"com.typesafe.akka" %% "akka-testkit" % akkaV % "test",
"org.specs2" %% "specs2-core" % "2.3.11" % "test",
"org.mongodb" %% "casbah" % "2.8.2"
)
}