Forum Discussion
David_Landry
Jan 24, 2012Nimbostratus
Need help with writing an iRule to remove jsession URI content
I've got a lovely challenge where I need to remove the jsessionid content from an URI.
https://test.com/web/tabs;jsessionid=07E052F5D
This would be on the server back to the cl...
nitass
Jan 24, 2012Employee
not sure if i understand correctly. anyway, i assume uri is response contact and jsessionid length is fixed. please feel free to revise.
[root@ve1023: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 {}
stream {}
tcp {}
}
}
[root@ve1023:Active] config b pool foo list
pool foo {
members 200.200.200.101:80 {}
}
[root@ve1023:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
STREAM::disable
HTTP::header remove "Accept-Encoding"
}
when HTTP_RESPONSE {
if {[HTTP::header value Content-Type] contains "text"}{
STREAM::expression {@;jsessionid=\w{9}@@}
STREAM::enable
}
}
}
[root@ve1023:Active] config curl -i http://200.200.200.101/test.html
HTTP/1.1 200 OK
Date: Tue, 24 Jan 2012 16:02:43 GMT
Server: Apache/2.2.3 (CentOS)
Last-Modified: Tue, 24 Jan 2012 15:58:04 GMT
ETag: "4183f2-a5-36565b00"
Accept-Ranges: bytes
Content-Length: 165
Set-Cookie: BROWSER=MOZILLA%20INTERNET_EXPLORER%20CHROME; path=/
Content-Type: text/html; charset=UTF-8
...
https://www.google.com/
https://test.com/web/tabs;jsessionid=07E052F5D
https://www.yahoo.com/
...
[root@ve1023:Active] config curl -i http://172.28.19.79/test.html
HTTP/1.1 200 OK
Date: Tue, 24 Jan 2012 16:02:46 GMT
Server: Apache/2.2.3 (CentOS)
Last-Modified: Tue, 24 Jan 2012 15:58:04 GMT
ETag: "4183f2-a5-36565b00"
Accept-Ranges: bytes
Set-Cookie: BROWSER=MOZILLA%20INTERNET_EXPLORER%20CHROME; path=/
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
...
https://www.google.com/
https://test.com/web/tabs
https://www.yahoo.com/
...
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects