Cherrypy - prevent browser "prefetch"?

Israel Brewster israel at ravnalaska.net
Mon Dec 1 17:19:36 EST 2014


On Dec 1, 2014, at 1:12 PM, Tim Chase <python.list at tim.thechases.com> wrote:

> On 2014-12-01 16:50, Ned Batchelder wrote:
>> On 12/1/14 4:26 PM, Tim Chase wrote:
>>> All this to also say that performing non-idempotent actions on a
>>> GET request is just begging for trouble. ;-)
>> 
>> This is the key point: your web application shouldn't be doing
>> these kinds of actions in response to a GET request.  Make them
>> POST requests, and Safari won't give you any trouble.
> 
> Though to be fair, based on the reading I did, Safari also pulls in
> the various JS and executes it too, meaning that merely
> (pre)"viewing" the page triggers any Google Analytics (or other
> analytics) code you have on that page, sending "page views" with a
> high bounce rate (looks like you only hit one page and never browsed
> elsewhere on the site).
> 
> Additionally, if the target GET URL involves high processing load on
> the server, it might be worthwhile to put a caching proxy in front of
> it to serve (semi)stale data for any preview request rather than
> impose additional load on the server just so a preview can be updated.

Right, and there are probably some URL's in my app where this may be the case - I still need to go back and audit the code now that I'm aware of this going on. In general, though, it does sound as though changing things to POST requests, and disallowing GET requests for those URLS in my CherryPy app is the way to go.

Thanks!

> 
> So I can see at least two cases in which you might want to sniff the
> "are you just previewing, or do you actually want the page"
> information.  Perhaps there are more.
> 
> -tkc
> 
> 
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

-----------------------------------------------
Israel Brewster
Systems Analyst II
Ravn Alaska
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7293
-----------------------------------------------




More information about the Python-list mailing list