You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by JM...@aol.com on 2003/04/16 17:59:45 UTC

F5 problem

This is an analogy of a problem we have found with our web server. We are 
using mod perl but this problem would occur regardless.

If I send up the following URL to our server

<A HREF="http://.../dpstuff.pl?action=add&name=ford&make=fiesta">http://.../dpstuff.pl?action=add&name=ford&make=fiesta</A>

the action add is performed on ford fiesta.

Now if I click F5 on my browser the same URL is sent up so another add is 
attempted with the same query. Is there any way to catch the fact that F5 has 
been hit so I dont even try to add again.

Or are there configuration setting to stop the same request refreshing ?

any help would be very much appreciated.

John Mc.    
    


Re: F5 problem

Posted by si...@siberian.org.
We just track this stuff in session and if the same 
request is made twice in a row we do a different action 
other then the add. Works well for maintaining the 
transaction during CC processing and things like that.

John-

On Wed, 16 Apr 2003 11:59:45 EDT
  JMcNamaraIRL@aol.com wrote:
>This is an analogy of a problem we have found with our 
>web server. We are 
>using mod perl but this problem would occur regardless.
>
>If I send up the following URL to our server
>
><A 
>HREF="http://.../dpstuff.pl?action=add&name=ford&make=fiesta">http://.../dpstuff.pl?action=add&name=ford&make=fiesta</A>
>
>the action add is performed on ford fiesta.
>
>Now if I click F5 on my browser the same URL is sent up 
>so another add is 
>attempted with the same query. Is there any way to catch 
>the fact that F5 has 
>been hit so I dont even try to add again.
>
>Or are there configuration setting to stop the same 
>request refreshing ?
>
>any help would be very much appreciated.
>
>John Mc.    
>     
>


Re: F5 problem

Posted by "C. Jon Larsen" <jl...@richweb.com>.
 
> I don't think its beneficial to try to catch this client side.  What would
> probably be better is to catch it on the server side, using something like
> formkeys.  i.e. generate a unique key for each webpage (like LA983401KAB or
> something) and put it in the forms as a hidden variable.  For the case below,
> tack it onto the url with something like &fkey=LA983401KAB.  Then when your
> application is processing the request, it can see that that formkey was already
> submitted, and handle it appropriately.  Either ignore the second request, or
> display an error, etc.

Or better yet, use a server side session for this. Roll your own, or use 
Apache::Session, or Cache::Cache might be useful. Hidden fields in forms 
can be spoofed or changed, so a secure solution needs to rely on the 
server side state, not the client.

> 
> -Andrew
> 
> At 11:59 AM 4/16/2003 -0400, JMcNamaraIRL@aol.com wrote:
> >This is an analogy of a problem we have found with our web server. We are 
> >using mod perl but this problem would occur regardless.
> >
> >If I send up the following URL to our server
> >
> ><http://.../dpstuff.pl?action=add&name=ford&make=fiesta>http://.../dpstuff.pl?action=add&name=ford&make=fiesta
> >
> >the action add is performed on ford fiesta.
> >
> >Now if I click F5 on my browser the same URL is sent up so another add is 
> >attempted with the same query. Is there any way to catch the fact that F5 
> >has been hit so I dont even try to add again.
> >
> >Or are there configuration setting to stop the same request refreshing ?
> >
> >any help would be very much appreciated.
> >
> >John Mc.
> >
> 

-- 
+ Jon Larsen: Chief Technology Officer, Richweb, Inc.
+ Richweb.com: Providing Internet-Based Business Solutions since 1995
+ GnuPG Public Key: http://richweb.com/jlarsen.gpg
+ Business: (804) 359.2220 x 101; Mobile: (804) 307.6939


Re: F5 problem

Posted by Andrew Hurst <hu...@llnl.gov>.
I don't think its beneficial to try to catch this client side.  What would
probably be better is to catch it on the server side, using something like
formkeys.  i.e. generate a unique key for each webpage (like LA983401KAB or
something) and put it in the forms as a hidden variable.  For the case below,
tack it onto the url with something like &fkey=LA983401KAB.  Then when your
application is processing the request, it can see that that formkey was already
submitted, and handle it appropriately.  Either ignore the second request, or
display an error, etc.

-Andrew

At 11:59 AM 4/16/2003 -0400, JMcNamaraIRL@aol.com wrote:
>This is an analogy of a problem we have found with our web server. We are 
>using mod perl but this problem would occur regardless.
>
>If I send up the following URL to our server
>
><http://.../dpstuff.pl?action=add&name=ford&make=fiesta>http://.../dpstuff.pl?action=add&name=ford&make=fiesta
>
>the action add is performed on ford fiesta.
>
>Now if I click F5 on my browser the same URL is sent up so another add is 
>attempted with the same query. Is there any way to catch the fact that F5 
>has been hit so I dont even try to add again.
>
>Or are there configuration setting to stop the same request refreshing ?
>
>any help would be very much appreciated.
>
>John Mc.
>