question

Paul Beardow avatar image
Paul Beardow asked

Multiple image requests from APL document

Hi,

I generally have two images in my APL, the background and an overlaid image showing the information linked to the response speech. These images are generated on-the-fly from a server I run on AWS to match the information being requested, and are time and location sensitive.

What I have noticed is that following the initial request and response I see multiple following requests for the images. Sometimes there are ten or more extra requests for the same image from different IP addresses several minutes later.

Where do these additional requests come from? Is it other devices connected to the user account? Or caching services being used to optimise image loading?

It's not a problem from a processing bandwidth standpoint, but as the information in the image is time sensitive it is concerning that invalid images may be being being cached.

Thanks in advance for any insight anyone can provide.

apl
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Andy Whitworth avatar image
Andy Whitworth answered

It does sound like a caching thing. To prevent the wrong (cached) image being shown, can you vary the image URL somehow for each image generated ? Or you can add a URL parameter with some unique value which will result in any cache being ignored.

This was discussed on the Alexa slack channel recently

https://alexacommunity.slack.com/archives/C01DR975R37/p1632799422043900?thread_ts=1632780421.039300&cid=C01DR975R37

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Paul Beardow avatar image
Paul Beardow answered

Hi Andy, I already do that with a time parameter to show when it is valid. The problem is that I still get multiple requests for that same URL from different IP addresses. It's like multiple devices are requesting the same image, rather than the same device requesting multiple times.

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Andy Whitworth avatar image
Andy Whitworth answered

Understand and I doubt if you'll get to the root cause of that as it's probably internal Amazon caching across regions/datacentres. It's only a problem for you if those cached images are being used when you don't want them to be used i.e. a time mismatch. The unique URL approach should solve that problem or are you finding that incorrect (cached) images are indeed being used ?

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Paul Beardow avatar image
Paul Beardow answered

The multiple regions would explain it - thanks. There is probably some "smart" caching going on. The timestamps mean the right image is used, I just wanted to be sure it wasn't something wrong in my APL.

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Andy Whitworth avatar image
Andy Whitworth answered

If you're so inclined then you could check the IP addresses against the Amazon list to see where the requests are coming from.


https://docs.aws.amazon.com/general/latest/gr/aws-ip-ranges.html

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.