I created a simple Spring Boot application which I host on Heroku. I access this backend application with a Flutter Web client.
When I run the Flutter Web client locally on my machine everything works like a charm until I deploy it via Firebase Hosting.
Then suddenly the requests to the Spring Boot application at Heroku fail with
heroku[router]: at=info method=OPTIONS path="/endpoint" host=app.herokuapp.com request_id=4c594a7e-4e0b-8d69-0987867cc203 fwd="87.135.1.137" dyno=web.1 connect=1ms service=53ms status=403 bytes=221 protocol=https
Any idea what could be the problem?
CodePudding user response:
I solved it by annotating my Controller class with @CrossOrigin
.
@RestController
@CrossOrigin
class ResponseController(val service: Service) {
@GetMapping("/endpoint")
@ResponseBody
suspend fun response(): ResponseWrapper = service.getResponse()
}