CORS issue - even for * Access-Control-Allow-Origin, Access-Control-Expose-Headers

0

We are facing cors error for each api we create. We are trying to access api from http://localhost:4201. is there any option to set the cors at global level. It is difficult to allow the origin url in each and every api

2개 답변
0

Can you confirm manually (e.g. via curl) that the CORS headers are present? Are you using a Lambda behind an API Gateway by any chance?

답변함 2달 전
0

Hi, Unfortunately API Gateway doesnot have any global mechanism to enable CORS on all API for the region. You would need to enable it on each API endpoint. Also, since the CORS header values will be of different for different applications, it may be of no use to create a global parameter.

Additionally, if the use-case is to specifically allow certain values on all the API's that you create,

  • You could create a base template with required CORS values set and then export the API
  • Use the exported API as template when you create new APIs so that you don't have to configure the same CORS values again
profile pictureAWS
지원 엔지니어
Bony_T
답변함 2달 전
profile picture
전문가
검토됨 2달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠