Pradeep_Kandala
Nov 24, 2012Nimbostratus
IRULE adding get or post
Hi,
I have to add a 6kb variable in post or get method of the url and forward the request.
Can you help or show an example.
Thanks a lot in advance,
Pradeep
[root@ve10:Active] config b virtual bar list
virtual bar {
snat automap
pool foo
destination 172.28.19.79: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_REQUEST {
log local0. ""
if { [HTTP::method] eq "POST" and $isretry == 0 } {
set origin_len [HTTP::header "Content-Length"]
set origin_type [HTTP::header "Content-Type"]
HTTP::collect $origin_len
}
}
when HTTP_REQUEST_DATA {
log local0. ""
set origin_payload [HTTP::payload]
HTTP::respond 302 Location http://[HTTP::host][HTTP::uri]
TCP::collect
}
when CLIENT_ACCEPTED {
log local0. ""
set isretry 0
}
when CLIENT_DATA {
log local0. ""
set newpayload [string map [list "GET" "POST" "\r\n\r\n" "\r\nContent-Length: ${origin_len}\r\nContent-Type: ${origin_type}\r\n\r\n${origin_payload}"] [TCP::payload]]
TCP::payload replace 0 [TCP::payload length] ""
TCP::payload replace 0 0 $newpayload
set isretry 1
TCP::release
}
}
on client
[root@centos251 ~] curl -i -L -b cookies.txt -c cookies.txt -d "test123456" http://172.28.19.79
HTTP/1.0 302 Found
Location: http://172.28.19.79/
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
HTTP/1.1 200 OK
Date: Sun, 25 Nov 2012 20:13:28 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
Content-Type: text/html; charset=UTF-8
...snipped...
on bigip
[root@ve10:Active] config tail /var/log/ltm
Nov 26 03:59:12 local/tmm notice tmm[7926]: 013e0001:5: Tcpdump starting bcast on :::0 from 127.1.1.1:57624
Nov 26 03:59:17 local/tmm info tmm[7926]: Rule myrule :
Nov 26 03:59:17 local/tmm info tmm[7926]: Rule myrule :
Nov 26 03:59:17 local/tmm info tmm[7926]: Rule myrule :
Nov 26 03:59:17 local/tmm info tmm[7926]: Rule myrule :
Nov 26 03:59:17 local/tmm info tmm[7926]: Rule myrule :
Nov 26 03:59:20 local/tmm notice tmm[7926]: 013e0002:5: Tcpdump stopping on 127.1.1.2:53186 from 127.1.1.1:57624
[root@ve10:Active] config ssldump -Aed -nni 0.0 port 80
New TCP connection 1: 172.28.19.251(38574) <-> 172.28.19.79(80)
1353873290.9627 (0.0009) C>S
---------------------------------------------------------------
POST / 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.79
Accept: */*
Content-Length: 10
Content-Type: application/x-www-form-urlencoded
test123456---------------------------------------------------------------
1353873290.9629 (0.0001) S>C
---------------------------------------------------------------
HTTP/1.0 302 Found
Location: http://172.28.19.79/
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
---------------------------------------------------------------
1353873290.9646 (0.0017) C>S
---------------------------------------------------------------
GET / 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.79
Accept: */*
---------------------------------------------------------------
New TCP connection 2: 200.200.200.10(38574) <-> 200.200.200.101(80)
1353873290.9668 (0.0009) C>S
---------------------------------------------------------------
POST / 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.79
Accept: */*
Content-Length: 10
Content-Type: application/x-www-form-urlencoded
test123456---------------------------------------------------------------
1353873290.9718 (0.0050) S>C
---------------------------------------------------------------
HTTP/1.1 200 OK
Date: Sun, 25 Nov 2012 20:13:28 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
Content-Type: text/html; charset=UTF-8
...snipped...
---------------------------------------------------------------
1353873290.9719 (0.0072) S>C
---------------------------------------------------------------
HTTP/1.1 200 OK
Date: Sun, 25 Nov 2012 20:13:28 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
Content-Type: text/html; charset=UTF-8
...snipped...
---------------------------------------------------------------
1 1353873290.9726 (0.0007) C>S TCP FIN
2 1353873290.9726 (0.0007) C>S TCP FIN
2 1353873290.9736 (0.0010) S>C TCP FIN
1 1353873290.9737 (0.0010) S>C TCP FIN