Forum Discussion
matt1985_299432
Nimbostratus
Sep 19, 2017Redirect and hide redirect in browser
Hi,
I have a basic requirement to redirect some content but also mask the redirect. So I was looking at a basic redirect so:
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/" } {
...
Jad_Tabbara__J1
Cirrostratus
Sep 19, 2017Hello Matt,
As suggested by Mr Plastic, you can use STREAM profile or use this irule to manage the modification :
N.B: You need to add a STREAM profile to your VS.
when HTTP_REQUEST {
Remove the "Accept-Encoding" header
HTTP::header remove "Accept-Encoding"
Finally change the URI while on its way to server.
HTTP::uri "/directory/mysite[HTTP::uri]"
Disable the stream filter for all requests
STREAM::disable
}
when HTTP_RESPONSE {
if { [HTTP::header exists Location] } {
set Location [HTTP::header Location]
if { $Location contains "/directory/mysite"} {
HTTP::header replace Location [string map {"/directory/mysite/" "/"} [HTTP::header Location]]
}
}
Check if response type is text or xml
if { [HTTP::header value Content-Type] contains "text" || [HTTP::header value Content-Type] contains "xml" } {
Replace /directory/mysite/ by /
STREAM::expression [ {@/directory/mysite/@/@} ]
Enable the stream filter for this response only
STREAM::enable
}
}
when STREAM_MATCHED {
Log each match found by the stream filter
log local0. "Stream filter matched: [STREAM::match]"
}
Hope it helps
Please give us a feedback
Regards
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
