I am trying to manipulate the expiration time of a cookie being sent from my web server (pretty sure its a session cokkie w/o an expriation time). However I am getting errors from the LTM.
the cookie name = PD-H-SESSION-ID
my irule =
when HTTP_RESPONSE {
if {[HTTP::cookie exists “PD-H-SESSION-ID”]} {
log local0. “I see PD-H-SESSION cookie”
HTTP::cookie expires PD-H-SESSION-ID 30 relative
}
}
my error in log =
irule-wildcard - Illegal argument (line 1) invoked from within “HTTP::cookie expires PD-H-SESSION-ID 30”
i tried double and single quotes for the cookie name
i tried using a variable to hold the cookie name
any ideas?
hoolio
November 14, 2011, 9:48pm
2
Can you try curly braces?
when HTTP_RESPONSE {
if {[HTTP::cookie exists "PD-H-SESSION-ID"]} {
log local0. "I see PD-H-SESSION cookie"
HTTP::cookie expires {PD-H-SESSION-ID} 30 relative
}
}
Aaron
Tried them all
( )
[ ]
{ }
All with the same error =
Rule [irule-wildcard] error: line 1: [braces are required around the expression] [when HTTP_RESPONSE { if {[HTTP::cookie exists “PD-H-SESSION-ID”]} { log local0. “I see PD-H-SESSION cookie” HTTP::cookie expires (PD-H-SESSION-ID) 30 relative } }]
hoolio
November 15, 2011, 2:17am
4
I wonder if this is a bug in the version of LTM you’re trying with HTTP::cookie expires. Which LTM version are you testing on?
I just tested on 11.0 and 10.2.2 and both work as expected:
when HTTP_RESPONSE {
log local0. "Inserting PD-H-SESSION-ID"
HTTP::cookie insert name "PD-H-SESSION-ID" value test path "/"
if {[HTTP::cookie exists "PD-H-SESSION-ID"]} {
log local0. "Set-Cookie (pre): [HTTP::header values Set-Cookie]"
HTTP::cookie expires {PD-H-SESSION-ID} 30 relative
log local0. "Set-Cookie (post): [HTTP::header values Set-Cookie]"
}
}
And here’s the log output:
< HTTP_RESPONSE>: Inserting PD-H-SESSION-ID
< HTTP_RESPONSE>: Set-Cookie (pre): {PD-H-SESSION-ID=test;path=/;}
< HTTP_RESPONSE>: Set-Cookie (post): {PD-H-SESSION-ID=test;expires=Tue, 15-Nov-2011 03:10:02 GMT;path=/;}
Aaron
nitass
November 15, 2011, 4:52am
6
this is mine.
[root@orchid:Active] config b version|grep -iA 1 version
BIG-IP Version 10.2.2 852.0
Hotfix HF1 Edition
[root@orchid:Active] config b virtual bar list
virtual bar {
snat automap
pool foo
destination 172.28.17.89:http
ip protocol tcp
rules myrule
profiles {
http {}
tcp {}
}
}
[root@orchid:Active] config b pool foo list
pool foo {
members 10.10.70.110:http {}
}
[root@orchid:Active] config b rule myrule list
rule myrule {
when HTTP_RESPONSE {
if {[HTTP::cookie exists "PD-H-SESSION-ID"]} {
log local0. "I see PD-H-SESSION cookie"
HTTP::cookie expires PD-H-SESSION-ID 30 relative
}
}
}
[root@orchid:Active] config curl -I http://10.10.70.110
HTTP/1.1 200 OK
Date: Mon, 14 Nov 2011 20:57:27 GMT
Server: Apache/2.0.59 (rPath)
Last-Modified: Sat, 11 Jun 2011 00:31:47 GMT
ETag: "667a-67-cfb682c0"
Accept-Ranges: bytes
Content-Length: 103
Vary: Accept-Encoding
Set-Cookie: PD-H-SESSION-ID=1234567890
Content-Type: text/html; charset=UTF-8
[root@orchid:Active] config curl -I http://172.28.17.89
HTTP/1.1 200 OK
Date: Mon, 14 Nov 2011 20:57:34 GMT
Server: Apache/2.0.59 (rPath)
Last-Modified: Sat, 11 Jun 2011 00:31:47 GMT
ETag: "667a-67-cfb682c0"
Accept-Ranges: bytes
Content-Length: 103
Vary: Accept-Encoding
Set-Cookie: PD-H-SESSION-ID=1234567890;expires=Tue, 15-Nov-2011 05:57:41 GMT;
Content-Type: text/html; charset=UTF-8
[root@orchid:Active] config cat /var/log/ltm
Nov 15 13:57:11 local/tmm info tmm[4878]: Rule myrule : I see PD-H-SESSION cookie