Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #81779

Re: Cherrypy - prevent browser "prefetch"?

From Ned Batchelder <ned@nedbatchelder.com>
Subject Re: Cherrypy - prevent browser "prefetch"?
Date 2014-12-01 16:50 -0500
References <6B74D6DD-A597-4BCF-8586-D0A56C9CDB77@ravnalaska.net> <20141201152608.09ca6f13@bigbox.christie.dr>
Newsgroups comp.lang.python
Message-ID <mailman.16471.1417470624.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 12/1/14 4:26 PM, Tim Chase wrote:
> On 2014-12-01 11:28, Israel Brewster wrote:
>> I don't know if this is a cherrypy specific question (although it
>> will be implemented in cherrypy for sure), or more of a general
>> http protocol question, but when using cherrypy to serve a web app,
>> is there anyway to prevent browser prefetch? I'm running to a
>> problem, specifically from Safari on the Mac, where I start to type
>> a URL, and Safari auto-fills the rest of a random URL matching what
>> I started to type, and simultaneously sends a request for that URL
>> to my server, occasionally causing unwanted effects.
>
> 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.

Trying to stop Safari from making the GET requests might work for 
Safari, but then you will find another browser, or a proxy server, or an 
edge-caching accelerator, etc, that makes the GET requests when you 
don't want them.

The way to indicate to a browser that it shouldn't pre-fetch a URL is to 
make it a POST request.

-- 
Ned Batchelder, http://nedbatchelder.com

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Cherrypy - prevent browser "prefetch"? Ned Batchelder <ned@nedbatchelder.com> - 2014-12-01 16:50 -0500

csiph-web