Cloud Front distribution managed by API Gateway

0

I am using a custom domain for my API, that I have deployed with the Serverless framework. I am aware that the AWS Console does not show a CloudFront distribution created by the Custom Domain name action.

The problem is that I am not taking advantage of caching for any API calls. The Response Header is always "x-cache: Miss from cloudfront".

Because I can't see the distribution in the console (or even through the CLI), there is no way I can review the caching configuration for it.

Does anybody have any clue on how to solve this problem / limitation?

Jean

질문됨 4년 전758회 조회
6개 답변
0

Hello:

If you want to take advantage of CloudFront's edge cache, you will need to create your own distribution to change the settings. You will want to configure your domain as a Regional endpoint instead of an Edge-optimized one.

Regards,
Bob

전문가
답변함 4년 전
0

Hello Bob, thanks for your response.

With the CloudFront distribution managed by API gateway, I have the domain of the API linked automatically with my custom domain.

If I create my own CloudFront distribution, I will have to link the API domain manually in the Cloud Front settings (Origin Domain Name). I am afraid that the API domain name can change after new deployments, breaking the access to it.

Is there a way to eliminate this risk?

Thank you very much.

Regards,
Jean

답변함 4년 전
0

Hello:

You can still use the custom domain feature in API Gateway to have a static endpoint that will not change no matter how many times you redeploy the underlying API. The key to this configuration is that you must configure the CloudFront distribution to pass through all headers (include the host header) when communicating with the origin. This is how the API Gateway distribution is configured behind the scenes.

Regards,
Bob

전문가
답변함 4년 전
0

Hi Bob,

Thank you. It makes sense, I will try this configuration then.

Just one final question: in this case I will have 2 CloudFront distributions, right?
My custom CloudFront distribution -> (pointing to)
the CloudFront distribution managed by API gateway -> (pointing to)
the API original endpoint.

Regards,
Jean

답변함 4년 전
0

Jean:

No, as I mentioned in my original post, you'd want to set your domain to a Regional endpoint to remove the second CloudFront distribution.

Regards,
Bob

전문가
답변함 4년 전
0

I see, Bob. Thank you very much for your help.

Regards,
Jean

답변함 4년 전

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

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

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

관련 콘텐츠