Forum Discussion
Rewrite
Hello I need to rewrite a url for a webapplication (that is accsed with a apm portal) from a absolute url to relative url (for a couple of reason there is no way of changing it in the code that generates the url)
So the full url looks like this: https://hejhej.hej.com/HFS/index.php?action
and i want to strip the https://hejhej.hej.com/HFS/
The irule looks like this, but i cant get it to work, it dont seems to find the urls, since they are left untouched
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] contains "f5-w-6874000033a2f2f73736c76706e2e6668732e7365$$" } {
Remove the Accept-Encoding header so that the server will not compress the response
(otherwise the stream rewriter won't work, since it doesn't decompress the stream)
HTTP::header remove "Accept-Encoding"
log local0. " Match"
Set a variable so we know to do custom stream rewrite
set strReplace 1
Disable the default stream profile so we can modify it on response
STREAM::disable
}
}
when HTTP_RESPONSE {
if { [info exists strReplace] && $strReplace && [HTTP::header "Content-Type"] contains "html" } {
STREAM::expression {@2 Replies
- What_Lies_Bene1
Cirrostratus
OK, could be a few things but lets start with checking both the if and the expression using some logging - add this here;
Set a variable so we know to do custom stream rewrite set strReplace 1 log local "Request matches, setting replace variable"This here;
when HTTP_RESPONSE { if { [info exists strReplace] && $strReplace && [HTTP::header "Content-Type"] contains "html" } { log local "Variable exists, variable is set to 1 and content type contains html"If we hit your "Match1" log statement after the first two we know its the stream expression. I must say it looks rather complex.
- supportrsd_1762
Nimbostratus
Strange, now i dont get the "Variable exists, variable is set to 1 and content type contains html" message, but im sure that i have gotten math1 before.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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