Forum Discussion
Stream Content Rewrite
Hi,
I have a requirement to rewrite some content and mask this from the connecting client. I originally had this working with a re-write profile but couldn't figure out how to do other things in an IRULE with a rewrite profile.
So I have the following IRULE some content needs rewriting '/content/site' which appears to work OK however some content needs to stay as is "/content/preserve/preserve" . So when I load the page the /content/site content appears to be ok however the /content/preserve/preserve doesn't load and not sure why.... my rule is below any help appreciated..
Thanks
Matt
when HTTP_REQUEST { HTTP::path [string tolower [HTTP::path]] if {[string tolower [HTTP::uri]] starts_with "/content/preserve/preserve/"} { continue STREAM::disable } elseif {[string tolower [HTTP::uri]] starts_with "/"} { set uri [string map -nocase {"/" "/content/site/"} [HTTP::uri]] HTTP::uri $uri STREAM::disable HTTP::header remove "Accept-Encoding" } } when HTTP_RESPONSE { STREAM::disable STREAM::expression {@/content/site/@/@}
Enable the stream filter for this response only
STREAM::enable
re-write Location header
HTTP::header replace Location [string map {/content/site/ /} [HTTP::header Location]]
}
- matt1985_299432
Nimbostratus
when HTTP_REQUEST { HTTP::path [string tolower [HTTP::path]] if {[string tolower [HTTP::uri]] starts_with "/content/preserve/preserve/"} { continue STREAM::disable } elseif {[string tolower [HTTP::uri]] starts_with "/"} { set uri [string map -nocase {"/" "/content/site/"} [HTTP::uri]] HTTP::uri $uri STREAM::disable HTTP::header remove "Accept-Encoding" } } when HTTP_RESPONSE { STREAM::disable STREAM::expression {@/content/site/@/@} Enable the stream filter for this response only STREAM::enable re-write Location header HTTP::header replace Location [string map {/content/site/ /} [HTTP::header Location]] }
- matt1985_299432
Nimbostratus
sorry formatting correctly
- vimaldiaz_23323
Nimbostratus
Hi Matt,
Did you to try configure Stream profile on Virtual Server? Instead of using i Rule
- matt1985_299432
Nimbostratus
Hi Thanks,
I thought you needed both? I had the default stream profile and then the IRULE.
- nathe
Cirrocumulus
Couple of questions, if you browse to content/preserve/preserve do you simply want to do nothing and is that what "continue" is in there for, in the first if statement? I'm not sure continue is a valid irule command (although i may be wrong). You could use the return or event commands instead e.g.
event disable all
You will probably need to enable OneConnect profile too - if you haven't already - to ensure all HTTP requests are evaluated.
Hopefully this helps,
N
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