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
エキスパート
回答済み 1ヶ月前
  • 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

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ