Forum Discussion

ringoseagull_77's avatar
ringoseagull_77
Icon for Nimbostratus rankNimbostratus
Nov 11, 2011

Setting to prevent users refreshing page with F5 button?

Is there a way of preventing users from using the F5 button to refresh a web page?

 

 

 

I'm using Version 10.1, 2 x 1500's.

 

  • insert javascript to html pages using irules

    http://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/50/aft/1179209/showtab/groupforums/Default.aspx

    disabling refresh, f5 on a webpage

    http://www.theserverside.com/discussions/thread.tss?thread_id=41154

    e.g.

    [root@ve1023:Active] config  b virtual bar list
    virtual bar {
       snat automap
       pool foo
       destination 172.28.65.152:http
       ip protocol tcp
       rules myrule
       profiles {
          http {}
          stream {}
          tcp {}
       }
    }
    [root@ve1023:Active] config  b pool foo list
    pool foo {
       members 200.200.200.101:http {}
    }
    [root@ve1023:Active] config  b rule myrule list
    rule myrule {
       when HTTP_REQUEST {
            STREAM::disable
    
            if {[HTTP::version] eq "1.1"} {
                    if { [HTTP::header is_keepalive] } {
                            HTTP::header replace "Connection" "Keep-Alive"
                    }
            }
    }
    
    when HTTP_RESPONSE {
            if {[HTTP::header Content-Type] starts_with "text/"} {
                    STREAM::expression "@@@"
                    STREAM::enable
            }
    }
    
    when STREAM_MATCHED {
            STREAM::disable
    }
    }
    
    [root@ve1023:Active] config  curl -i http://200.200.200.101
    HTTP/1.1 200 OK
    Date: Fri, 11 Nov 2011 14:57:59 GMT
    Server: Apache/2.2.3 (CentOS)
    Last-Modified: Fri, 11 Nov 2011 14:48:14 GMT
    ETag: "4183e4-3e-9c564780"
    Accept-Ranges: bytes
    Content-Length: 62
    Connection: close
    Content-Type: text/html; charset=UTF-8
    
    
    
    
    This is 101 host.
    
    
    
    [root@ve1023:Active] config  curl -i http://172.28.65.152
    HTTP/1.1 200 OK
    Date: Fri, 11 Nov 2011 14:58:06 GMT
    Server: Apache/2.2.3 (CentOS)
    Last-Modified: Fri, 11 Nov 2011 14:48:14 GMT
    ETag: "4183e4-3e-9c564780"
    Accept-Ranges: bytes
    Connection: close
    Content-Type: text/html; charset=UTF-8
    Transfer-Encoding: chunked
    
    
    
    
    This is 101 host.
    
    
    
    
  • sorry it appears HTTP::version 1.0 command is missing.

    this is the revised one.

    [root@ve1023:Active] config  b rule myrule list
    rule myrule {
       when HTTP_REQUEST {
            STREAM::disable
    
            if {[HTTP::version] eq "1.1"} {
                    if { [HTTP::header is_keepalive] } {
                            HTTP::header replace "Connection" "Keep-Alive"
                    }
                    HTTP::version 1.0
            }
    }
    
    when HTTP_RESPONSE {
            if {[HTTP::header Content-Type] starts_with "text/"} {
                    STREAM::expression "@@@"
                    STREAM::enable
            }
    }
    
    when STREAM_MATCHED {
            STREAM::disable
    }
    }
    
    
  • Hum,

    thanks! i tested and it seemed to be okay, so i thought it might be fine. i moved the script to be inside head tag as follows.

    [root@ve1023:Active] config  b rule myrule list
    rule myrule {
       when HTTP_REQUEST {
            STREAM::disable
    
            if {[HTTP::version] eq "1.1"} {
                    if { [HTTP::header is_keepalive] } {
                            HTTP::header replace "Connection" "Keep-Alive"
                    }
                    HTTP::version 1.0
            }
    }
    
    when HTTP_RESPONSE {
            if {[HTTP::header Content-Type] starts_with "text/"} {
                    STREAM::expression "@@@"
                    STREAM::enable
            }
    }
    
    when STREAM_MATCHED {
            STREAM::disable
    }
    }
    
    [root@ve1023:Active] config  curl -i http://172.28.65.152
    HTTP/1.1 200 OK
    Date: Fri, 11 Nov 2011 15:24:33 GMT
    Server: Apache/2.2.3 (CentOS)
    Last-Modified: Fri, 11 Nov 2011 14:48:14 GMT
    ETag: "4183e4-3e-9c564780"
    Accept-Ranges: bytes
    Connection: close
    Content-Type: text/html; charset=UTF-8
    
    
    
    
    This is 101 host.
    
    
    
    
  • and done. Thanks again!

     

     

    http://devcentral.f5.com/weblogs/jason/archive/2011/11/16/stop-that-f5-key-from-refreshing-the-page.aspx