Forum Discussion
jba3126
Oct 29, 2015Cirrus
Best method to rewrite Request and Response URI, preserve URI data, and with no client redirect
Looking for the best method (iRule, HTTP Class, etc) to rewrite URI while preserving the trailing data in the URI and ensuring that no client redirect occurs. I also need to insert a header in the m...
Brad_Parker
Oct 29, 2015Cirrus
Try adding the default stream profile and using and iRule like this:
when HTTP_REQUEST {
HTTP::header insert "SetContextURI" "http://[HTTP::host][HTTP::path]"
HTTP::path [string map {/123 /321/PRServlet} [HTTP::path]]
Disable the stream filter for all requests
STREAM::disable
LTM does not uncompress response content, so if the server has compression enabled
and it cannot be disabled on the server, we can prevent the server from
sending a compressed response by removing the compression offerings from the client
HTTP::header remove "Accept-Encoding"
}
when HTTP_RESPONSE {
STREAM::expression {@/321/PRServlet@/123@}
Enable the stream filter for this response only
STREAM::enable
re-write Location header
HTTP::header replace Location [string map {/321/PRServlet /123} [HTTP::header Location]]
}
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