2개 답변
- 최신
- 최다 투표
- 가장 많은 댓글
0
Turns out that running the express app on API Gateway in a subfolder means I have to add the /prod prefix to the express get handler as /prod/blog*
답변함 2년 전
0
Your API Gateway is returning 301 redirects on requests for /blog to /blog/
Requests for /blog/ result in a 403 which I believe is the correct behavior. However, this isn't the case for (eg) /maps - that just returns a 403 immediately, not a redirect to /maps/
I think the problem is that CloudFront has cached the 301 response for /blog and is serving it for subsequent requests for /blog/
To solve this, the best option would be to remove the direct from /blog to /blog/ if possible. Once you've done that, you'll need to invalidate /blog in the CloudFront cache.
관련 콘텐츠
- AWS 공식업데이트됨 2년 전
Thanks @Paul_L, you've hit on the crux of the problem. The express app I described returns the index.html file in all other implementations, but the API Gateway does not for some reason I can't figure out. You can see the index.html file is returned here (if you view source): https://wpreykda9j.execute-api.us-west-2.amazonaws.com/prod/blog/index.html