"405 method not allowed" react js application in aws amplify

Viewed 850

I have a problem deploying a react js application in aws amplify.

When the react application sends a POST request to a backend (spring boot) I receive "405 method not allowed"

Any help !

Spring boot project is deployed in EC2.

@PostMapping("/post")
@CrossOrigin(origins = "https://xxx.amplifyapp.com/")
public HttpStatus post(@RequestBody) {
    .......
}

In react i use createProxyMiddleware :

const {createProxyMiddleware} = require('http-proxy-middleware');

module.exports = function(app) {
    app.use('/api', createProxyMiddleware({ target: 'http://ec2-springboot.com:8082/'}));

}
0 Answers
Related