Dynamic data to Cloudfront error pages

0

I have a cloudfront distribution setup to serve images from an s3 bucket, and a custom error page to handle 404 responses if the image does not exist in my bucket. The error page points to an API Gateway endpoint that generates an image given a set of parameters. Those parameters are provided by the client through the input URI when making a request to the cloudfront distribution.

Is there a way for me to pass that data to my API endpoint, like adding headers or query parameters to the url? The problem I am facing is that when the original client request is met with a 404 response, the error page handler makes a separate request to the desired endpoint (which is a static url), and does not seem to carry over any data from the original request.

1개 답변
0

Hello, try to pass the required parameters to your API Gateway endpoint by appending them as query parameters to the error page URL. This way, when the error page handler triggers a request to the API endpoint, the parameters will be included in the URL and accessible to your endpoint for generating the image.

profile picture
전문가
답변함 한 달 전
  • How can I append dynamic parameters to the error page url? A client might request asset 1 with a set of modifications which might 404, requiring an api call. Another client might request asset 2 with another set of modifications which might also 404, requiring another API call with specific query parameters for that request

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠