I have images that get generated on the fly, using a PHP script that resizes the file. When I call the PHP script URL using Cloudfront, I receive the following error:
"The type of request you are making could not be processed.
Please ensure that your original image is of a supported
file type (jpg, png, tiff, webp, svg, gif) and that
your image request is provided in the correct syntax.
Refer to the documentation for additional guidance on
forming image requests."
The details of the image width and other settings are saved as get parameters in the URL.
A URL can look like this:
/index.php?eID=dumpFile&t=r&r=186793&s=800c%3A800c%3A800%3A800%3A800%3A800&cv=default&token=some-token-id
The response header of the image looks like this:
I also added the server as a valid origin on Cloudfront.
I wrote a static redirect for my URL, to see if Cloudfront is not working with get parameters, but adding a redirect also didn't work.
Redirect /test/image.jpg /index.php?eID=dumpFile&t=r&r=186793&s=800c%3A800c%3A800%3A800%3A800%3A800&cv=default&token=some-token-id
And then calling:
https://abcdefg.cloudfront.net/test/image.jpg
So how can I get Cloudfront to fetch my images using the /index.php
url?
This seems basic CloudFront setup.
CF distribution -> CF behahior -> custom origin.
The cache policy associated to the behavior should use the query parameters as part of the cache key.
The origin request policy should forward all query parameters.
You should detail your current CF setup.