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 Antwort
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
EXPERTE
beantwortet vor einem Monat
  • 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

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen