How to solve “x-cache: Error from cloudfront” on SPA

倖福魔咒の 提交于 2020-01-14 03:17:30

问题


We are having issues trying to make working a SPA with a client router (react router). We are using the concept of have a DOMAIN -> CDN (CloudFront) -> S3 for serving our static files.

We have configured the S3 for serving static files. The CDN are configured to have the origin from the S3 and we have configured custom error pages to catch errors:

with this configuration we can catch errors like this:

https://www.example.com/custom-url

The CDN will redirect all the 404/403 errors to the main index.html and react router will get the correct routing.

We have working our site, and the client router is working fine, but we have a problem with the response of our CDN with x-cache: Error from cloudfront:

If we access to the main url https://www.example.com without any query param (not query string) all works fine.

How can I solved this problem and make that all my dynamic URLs work?

Thanks.

来源:https://stackoverflow.com/questions/59160472/how-to-solve-x-cache-error-from-cloudfront-on-spa

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!