Cherrypy - prevent browser "prefetch"?

Tim Chase python.list at tim.thechases.com
Mon Dec 1 17:12:07 EST 2014


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.

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






More information about the Python-list mailing list