The URL Rewrite feature
enables to preemptively resolve host names in embedded URLs present
within HTML content and rewrite them with resolved IP addresses.
This rewriting helps to eliminate DNS round trips in high latency
mobile networks resulting in faster responses.
Enabling/disabling
the URL Rewrite feature is a CLI-configurable parameter. By default
the URL Rewrite feature is disabled.
IMPORTANT:
The URL Rewrite feature
needs a valid DNS client to be configured in the ISP (destination) context.
When the URL Rewrite
feature is enabled, TPO rewrites URLs of the following format
http://<host_name[:port]>/<url_path>/<file_name.extension>
into
http://<resolved_ip_address[:port]>/<url_rewrite_prefix>/<host_name[:port]>/<url_path>/<file_name.extension>
For example, if the
URL Rewrite prefix is urlrewrite,
TPO rewrites the URL
http://www.google.com/test.img
into
http://209.85.153.103/urlrewrite/www.google.com/test.img
When the mobile client
requests for the URL
http://<resolved_ip_address[:port]>/<url_rewrite_prefix>/<host_name[:port]>/<url_path>/<file_name.extension>
TPO rewrites the URL
back to
http://<host_name[:port]>/<url_path>/<file_name.extension>
The URL Rewrite prefix
is a CLI-configurable parameter. By default, the prefix is set to “urlrewrite”.
URL Rewrite works only
on HTML content, hence it is called only in the following cases:
- Content in response
to HTTP GET request where MIME type of the content is HTML/CSS/JavaScript
- Content is not encoded
TPO rewrites only those
URLs that are present in the following HTML tags:
- image
- imagepath
- img
- input
- link
- script
IMPORTANT:
URLs that are part of
JavaScript and VBScript are not rewritten.
If an HTML tag spans
across packets, TPO will queue only two packets and will rewrite
the URL if found.
The following figure
and steps explain how the HTTP URL Rewrite feature works:
Figure 4. HTTP URL Rewrite
- The mobile client sends
HTTP request for HTML content.
- TPO forwards the HTTP
request to the Web server.
- The Web server sends
an HTTP response with the requested HTML content.
- TPO resolves host names
in embedded URLs present within the HTML content and rewrites them
with corresponding IP addresses.
- TPO forwards the HTTP
response to the mobile client.
- The mobile client’s
browser parses the HTML and sends HTTP requests for images and other
content to the modified URLs.
- TPO rewrites the URLs
and forwards the HTTP requests to the Web server.
- The Web server returns
HTTP response with the requested content.
- TPO forwards the HTTP
response to the mobile client.
In case both HTTP Compression
and URL Rewrite features are enabled, URL Rewrite processing will
happen before HTTP Compression.