X-Fastly-Imageopto-API
Contains configuration for Image Optimizer.
Fastly reads this header from requests. It is proprietary to Fastly.
This header is read by Fastly to determine whether a request should be processed by Image Optimizer. It can also be used to specify whether query parameters should be ignored or passed on to the origin.
if (req.url.ext ~ "(?i)^(gif|png|jpe?g|webp)$" || req.url.path ~ "^/images/") { set req.http.x-fastly-imageopto-api = "fastly";}
By default, all query parameters are stripped, even those that are not recognized by the image optimizer. To allow passthrough of custom query params (i.e. those that are not recognised by IO) to your origin, opt-in by changing the value to include the qp
parameter:
set req.http.X-Fastly-Imageopto-Api = "fastly; qp=*";
With this opt-in enabled, a request for image.png?width=300&something=foo
would trigger the original image to be loaded from your origin server with a request URI of image.png?something=foo
. The known parameter has been removed, but the unknown parameter was passed through.
WARNING: Enabling the qp=*
override may reduce the image cache hit ratio and increase traffic to your origin servers.