Forum Discussion
Redirect 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 "/" } {
HTTP::uri "/directory/mysite[HTTP::uri]"
}
}
Which of course redirects however i would like to hide /directory/mysite from the browser does anyone know how do achieve that?
Thanks
matt
- matt1985_299432
Nimbostratus
sorry i should add the address bar is fine but i would like to also remove /directory/mysite from the other pages on the site
- Lee_Sutcliffe
Nacreous
Hi,
You can use a Stream profile to do replace the embedded links within the site. This can be done with just a simple profile if you're just replacing one thing for another. Or can be done as part of an iRule if you require anything more complicated:
https://support.f5.com/csp/article/K8115
MP
- Jad_Tabbara__J1
Cirrostratus
Hello 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
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