I have a simple method to upload a file in a service
def addFileTest(): Action[AnyContent] = Action { request: Request[AnyContent] =>
val file = request.body.asMultipartFormData.get.file("file")
val fileRef = FileRef(file.get.ref.path.toUri.toString)
//FileRef is wrapper to File
Ok("File uploaded " + fileRef.getContentAsStringSync)
}
and a file with the following content:
<!-- saved from url=(0120)https://energyplus.net/weather-download/europe_wmo_region_6/NLD//NLD_Amsterdam.062400_IWEC/NLD_Amsterdam.062400_IWEC.epw -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body>
LOCATION,Napier,Hawkes Bay,New Zealand,TMY2 NIWA 2980 D96484,933730,-39.46,176.86,12,3
When I try to upload a file on my local machine, everything works fine, I get this result back:
File uploaded <!-- saved from url=(0120)https://energyplus.net/weather-download/europe_wmo_region_6/NLD//NLD_Amsterdam.062400_IWEC/NLD_Amsterdam.062400_IWEC.epw -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body>LOCATION,Napier,Hawkes Bay,New Zealand,TMY2 NIWA 2980 D96484,933730,-39.46,176.86,12,3
Deploying the service on AWS with an SSL certificate I get a 403:
<html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</h1></center>
</body>
</html>
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
Any ideas why I get a 403 on AWS? From my testing it looks like the HTML tag is at fault. I tried to remote debug it but it is not reaching my code.