SPA - Cloudfront + S3 403/404 이슈

2022. 7. 28. 15:06AWS/Amazon CloudFront

728x90
SMALL

- 개요

React 등으로 SPA를 서빙하기 위해 Route53 -> CF - CNAME + S3 를 사용하는 경우 sub-path를 직접 호출 시 403 에러가 난다. Root Routing 이 정상적으로 되기 위해서는 403, 404를 200 index.html로 보내야 한다.

 

 

- 설정 방법

CloudFront
>> Distributions
>> Error Pages
>> Create custom error reponse
>> HTTP error code 403 // HTTP error code 404
>> Customize error reponse
>> Yes
>> Response page path : /index.html
>> HTTP Reponse code : 200

>> Invalidation /*

 

 

728x90
LIST

'AWS > Amazon CloudFront' 카테고리의 다른 글

Cloudfront monitoring metric & reports  (0) 2022.11.04
cloudfront s3 redirect access denied  (0) 2022.10.20
Cloudfront supports HTTP/3  (0) 2022.08.16
CORS error (Route53 + Cloudfront CNAME + S3)  (0) 2022.07.29
Cloudfront Origin Shield  (0) 2022.07.29