It’s funny to detect if you append query parameters to a PDF URL, the server responses with an image instead of the PDF file. Well funny until you get an email saying this URL is in the newsletter you just sent
Here without query parameters, gets the PDF
Here with two o more query parameters, get an image
It is a bug? Or it is possible to avoid it?
As you said, every file that goes through Imgix (if you pass any parameters) is returned as an image.
As an example, if i have a sample PDF https://www.datocms-assets.com/82186/1664800813-sample.pdf and i want to restrict its width to 500, it will have to become an image: https://www.datocms-assets.com/82186/1664800813-sample.pdf?w=500
Can you share with us your use-case for the imgix parameters for PDFs?
My problem is with redirects 30x to the static urls.
I have an intermediate tracking endpoint that counts the access, downloads, etc … of some assets. And when I perform the redirection towards the file the params are transfer as well, and PDF urls returns an image as in the example
@mordonez.sanchez i see, unfortunately we can’t do much about this as when you pass those parameters, IMGIX interprets that the file should be rasterised into an image, and have the transformations applied on that image, which are valid uses for the parameters in a PDF file.
So the only way to fix this would be to not pass the parameters in your intermediary endpoints, if you don’t want them to be applied in the file.
Thank’s @m.finamor for the support.
It was my first approach , but in Netlify where I host the project when I do a redirect in a netlify function always pass the query params to the Location Disable Netlify passing query params on 302 redirect - Support - Netlify Support Forums
"Location": assetUrl ,
If helps to another, my solution finally was to override the asset url with a custom query param like “?view” at the end
"Location": assetUrl + '?view',