IOS – Website URLs seem to refresh in the background

iospythonsafari

I have written a Python script hosted on a Raspberry Pi that controls my garage doors. The doors are operated by sending a GET request to one of a few URLs on the server. It's only available within the LAN.

We use three iPhones, two 7s and a 6, all with the latest iOS version, to operate it with Safari.

By inspecting my server logs I am finding that one of the 7s and the 6 appear to be firing GET requests an random times, even in the middle of the night for example, causing my doors to open 'by themselves'. The other 7 doesn't seem to do this.

I've tried leaving it with the URLs added to the home screen, and also just bookmarked in Safari, but it doesn't seem to change the behaviour.

Is there some kind of background app refresh going on here that I don't know about, or could it be some other kind of fault? The Python end seems to be fine as the logging shows that it's responding to legitimate GET requests each time, but I can't find a difference between the iPhones that exhibit the behaviour and the one that doesn't.

Can you help? Thank you!

Best Answer

Many browsers do prerendering for often-visited sites. It's possible Safari is preloading the URL as a top hit because you visit that URL a lot. Some browsers also prefetch sites to create image previews.

HTTP GETs are supposed to be safe and idempotent according to the W3C standards. Many browsers (and proxy servers) make the assumption that it's safe to trigger and/or cache GETs. POSTs are supposed to be used for effect-inducing operations.