Forum Discussion

bilsch_10068's avatar
bilsch_10068
Icon for Nimbostratus rankNimbostratus
Jan 02, 2013

HTTP::cookie in HTTP_RESPONSE

Ok,

 

so I have a set-cookie line which an app is setting and I need to re-format the cookie set ( bugs, yay ). Lets say the cookie is "foo"

 

I would expect that this would work but I can verify by looking at the responses it is not working.

 

 

when HTTP_RESPONSE {

 

if { [HTTP::cookie exists "foo"] } {

 

HTTP::cookie remove foo

 

}

 

}

 

 

There is a header similar to:

 

Set-Cookie: foo=;Version=0;Comment="foo Cookie";Path=/foo;Max-Age=31536000;Secure; Expires=Sat, 01-Jan-2012 00:000:00; HTTPOnly

 

 

Any idea why doing a cookie remove ( to re-add correctly later ) would not work in a response? Do I need to do this in response_data? ( I thought that was just for the body of the response which this is not, this is in headers.... )

 

 

 

4 Replies

  • what is not working? it does not delete all the cookie attributes in my lab. is it same as yours?

    [root@ve10:Active] config  b virtual bar list
    virtual bar {
       snat automap
       pool foo
       destination 172.28.19.252:80
       ip protocol 6
       rules myrule
       profiles {
          http {}
          tcp {}
       }
    }
    [root@ve10:Active] config  b pool foo list
    pool foo {
       members 200.200.200.101:80 {}
    }
    [root@ve10:Active] config  b rule myrule list
    rule myrule {
       when HTTP_RESPONSE {
      if { [HTTP::cookie exists "foo"] } {
        HTTP::cookie remove foo
      }
    }
    }
    
    [root@ve10:Active] config  ssldump -Aed -nni 0.0 port 80
    New TCP connection 1: 172.28.19.251(35796) <-> 172.28.19.252(80)
    1357174615.5795 (0.0010)  C>S
    ---------------------------------------------------------------
    HEAD / HTTP/1.1
    User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
    Host: 172.28.19.252
    Accept: */*
    
    ---------------------------------------------------------------
    
    New TCP connection 2: 200.200.200.10(35796) <-> 200.200.200.101(80)
    1357174615.5806 (0.0010)  C>S
    ---------------------------------------------------------------
    HEAD / HTTP/1.1
    User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
    Host: 172.28.19.252
    Accept: */*
    
    ---------------------------------------------------------------
    
    1357174615.5816 (0.0009)  S>C
    ---------------------------------------------------------------
    HTTP/1.1 200 OK
    Date: Thu, 03 Jan 2013 00:58:54 GMT
    Server: Apache/2.2.3 (CentOS)
    Last-Modified: Sat, 27 Oct 2012 03:22:35 GMT
    ETag: "4183f3-59-f28f94c0"
    Accept-Ranges: bytes
    Content-Length: 89
    Set-Cookie: foo=;Version=0;Comment="foo Cookie";Path=/foo;Max-Age=31536000;Secure; Expires=Tue, 01-Jan-2012 00:00:00 GMT; HTTPOnly
    Content-Type: text/html; charset=UTF-8
    
    ---------------------------------------------------------------
    
    1357174615.5817 (0.0021)  S>C
    ---------------------------------------------------------------
    HTTP/1.1 200 OK
    Date: Thu, 03 Jan 2013 00:58:54 GMT
    Server: Apache/2.2.3 (CentOS)
    Last-Modified: Sat, 27 Oct 2012 03:22:35 GMT
    ETag: "4183f3-59-f28f94c0"
    Accept-Ranges: bytes
    Content-Length: 89
    Set-Cookie: Expires=Tue, 01-Jan-2012 00:00:00 GMT; HTTPOnly
    Content-Type: text/html; charset=UTF-8
    
    ---------------------------------------------------------------
    
  • what I want to do is reformat the content of the Set-Cookie header on the way back out

     

  • what I want to do is reformat the content of the Set-Cookie header on the way back outi think you may have to use HTTP::header (remove and insert) instead of HTTP::cookie. the following is an example of HTTP::header insert.

     

     

    Setting Cookie "HttpOnly" flag and Expires on Redirect and response

     

    https://devcentral.f5.com/community/group/aft/2159060/asg/50