Lambda@Edge to configure SPA client side routing? (ReactJS) S3 + CloudFront

0

My website is a static site in S3 and I'm using CloudFront. Since it is a SPA , the origin returns a 404 error on every request but loads the page successfully. To solve this I have created a custom error in "Error page" in CloudFront so that it returns a status 200. (This is what is recommended in most blogs) This works fine but on every html request I see cache: "Error from CloudFront".

My question is if CloudFront is caching the request or is it always going to the origin? Would it be better to handle this with a Lambda@Edge? How?

Thanks in advance!

Gabym
已提問 9 個月前檢視次數 228 次
1 個回答
0

Hi,

When you configure the custom error page there is TTL Enter image description here

About the Lambda@Edge, at least it will cost you additional money for something that is free now.

profile picture
專家
已回答 9 個月前
profile pictureAWS
專家
已審閱 9 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南