我收到此错误
org.apache.coyote.http11.Http11Processor.service Error parsing HTTP request header
Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens
我有一个应用https://test.com,我打电话给后端服务器,从亚马逊s3云存储中检索文件。后端呼叫为https://backend.com/api/getFile
弹簧启动控制器的示例
@RequestMapping(value = "/api/getFiles", method = RequestMethod.POST)
public ResponseEntity<?> getAllFules(@RequestBody String test){
try{
//some code
return new ResponseEntity<Object>("ok", HttpStatus.OK);
}catch(Exception e){
return new ResponseEntity<Object>("not ok", HttpStatus.BAD_REQUEST);
}
}
后端服务器运行的nginx路由到proxy_pass http://127.0.0.1:8080/
客户端http代码在angular
中是这样的$http({
url: 'https://www.backend.com/api/getFiles',
method: "POST",
data: auth.profile['email']
})
.then(function(response) {
console.log(" post success get files");
},
function(response) { // optional
// failed
console.log("post failed get files");
})