0

Does Spring Cloud Function provide some kind of functionality similar to Spring Security Filter Chains ? One particular use case is to implement CORS with AWS Lambda API Gateway in proxy integration mode. According to the AWS docs, it's function responsibility to add CORS headers to the response. It might be more useful to do this at the integration layer and not in the business logic.

I'm using Spring Cloud Function with AWS adapter and Spring Boot. I've browsed through the code (3.1.3 at the time of writing) but didn't find something alike. There's one old issue showing CorsFilter registration (with Azure provider) but I doubt it really worked as Spring Cloud Function does not utilize Servlet environment.

Boris Fox
  • 1
  • 2
  • No we don't, but we provide you with function composition feature where you can have "integration/infrastructure layer" function composed with business logic. For example, `addCORSheadersFunction | myBusinessFunction`. So effectively you can create the filter chain yourself as long or as short as you want. – Oleg Zhurakousky Aug 26 '21 at 14:45
  • Thanks, it seems to work, but I can't figure out how to return error response from the first function and skip rest of the composition chain, to abort the entire request with 403 Forbidden when origin is not allowed. Throwing unhandled exception lead to 500 Internal Server Error response, and exception wrapped in ErrorMessage got passed down the chain to myBusinessFunction input. – Boris Fox Aug 28 '21 at 03:27

0 Answers0