Forum Discussion
Rewrite the content in URI with a short URL
- Jun 12, 2014
I am unable to update my original post. Here is an updated version.
If you simply want to mask URL's then apply a STREAM profile with the following iRule.
when HTTP_REQUEST { log local0. "..in HTTP_REQUEST" no replacement for requests STREAM::disable disable compression server side HTTP::header remove "Accept-Encoding" } when HTTP_RESPONSE { log local0. "...in HTTP_RESPONSE" only replace text content if {!([HTTP::header value Content-Type] contains "text")}{ return} set search "" foreach pair [class get myclass] { set search "$search@[lindex $pair 0]@[lindex $pair 1]@" } log local0. "String replace=$search" STREAM::expression $search STREAM::enable }
Then create a string data class myclass as follows...
Name Value /secureapp/connect/report_en/REP /en /peter /pan
And get the following output from a logs
Rule /Common/myrule : ...in HTTP_REQUEST Rule /Common/myrule : ...in HTTP_RESPONSE Rule /Common/myrule : search=@/secureapp/connect/report_en/REP@/en@@/peter@/pan@
And the resulting web page...
It works! /en /pan
The STREAM commands allow search and replace of data passing to and from the webserver. In this case I have enabled it only on the response coming back from the webserver... (STREAM::enable/disable). The stream expression is a sequence of search and replace pairs in the format @search@replace@. The foreach loop builds a stream expression from name and value pairs in the class myclass. We also turn off compression as most websites send data compressed although the user is never aware of this but we cannot process compressed data. Removing the Accept-Encoding header means the website will not compress the reply.
So any webpage with http://www.myweb.com/secureapp/connect/report_en/REP/XYZ on it will display http://www.myweb.com/en/XYZ instead.
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