i agree with nathan. http profile and irule seem to be the most straight way to achieve this. anyway, if you can't use http profile, you have to collect tcp payload, parse http header and response manually.
e.g.
[root@ve1023:Active] config b virtual bar list
virtual bar {
destination 172.28.19.79:80
ip protocol 6
rules myrule
}
[root@ve1023:Active] config b rule myrule list
rule myrule {
when CLIENT_ACCEPTED {
TCP::collect
}
when CLIENT_DATA {
set uri [findstr [TCP::payload] "GET " 4 " "]
set host [findstr [TCP::payload] "Host: " 6 "\r\n"]
TCP::respond "HTTP/1.0 302 Found\r\nLocation: https://$host$uri\r\nConnection: Keep-Alive\r\nContent-Length: 0\r\n\r\n"
TCP::release
}
}
[root@ve1023:Active] config curl -i http://172.28.19.79/whatever
HTTP/1.0 302 Found
Location: https://172.28.19.79/whatever
Connection: Keep-Alive
Content-Length: 0