claudiajs / claudia-api-builder

Use AWS API Gateway as if it were a lightweight JavaScript web server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add 'Access-Control-Allow-Origin' header to Authorizer's error responses

anton-107 opened this issue · comments

When using Cognito Authorizer, I'm hitting an endpoint being Unauthorized, browser throws the following error:

"No 'Access-Control-Allow-Origin' header is present on the requested resource"

This can be solved in API Gateway Console by setting a 'Access-Control-Allow-Origin' header in 'Gateway responses' > 'Unauthorized' > 'Response header'

Would be great if this header can be set by ClaudiaJS automatically (probably it's a good idea to set it on other responses as well).

this is implemented, you can set custom responses from claudia-api-builder 3.0.0 onwards.

this is now on NPM, as version v3.0.0