2 Respuestas
- Más nuevo
- Más votos
- Más comentarios
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*
respondido hace 2 años
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.
Contenido relevante
- OFICIAL DE AWSActualizada hace un año
- OFICIAL DE AWSActualizada hace 2 años
- OFICIAL DE AWSActualizada hace 2 años
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