Forum Discussion
Michael_Yates
Nimbostratus
Nov 14, 2006URI Rewrite for Server Pool
I have an issue which after reviewing numerous other posts...isn't covered.
I have a site connected to a server pool that is accessed by a normal URL (http://website.domain.com), but returns...
Nov 15, 2006
A few corrections. In the HTTP protocol, the server does not return a server name and location as part of the HTTP response.
Here's a trace for a request for http://www.foo.com/index.htmlGET /index.html HTTP/1.0
User-Agent: browser-id-string
Host: www.foo.com
Pragma: no-cache
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
and here's the response:HTTP/1.1 200 OK
Date: Wed, 15 Nov 2006 19:00:12 GMT
Server: server-id-string
Last-Modified: Fri, 18 Mar 2005 15:33:33 GMT
ETag: "75e5-ced-19dd0d40"
Accept-Ranges: bytes
Content-Length: 3309
Connection: close
Content-Type: text/html; charset=ISO-8859-1
Content...
As you'll see there is no Host header in the response, nor any host or uri indication whatsoever.
The URI in the browser is based on the URL in the initial request. A server can opt to change this by issuing a HTTP Redirect (ie. a HTTP 301 response) to the browser with the Location Header containing the alternate URL to then connect to.
With that being said, I can only assume that you would like the BIG-IP and iRules to do the 30x redirection for you. This can be done by changing the Host header in the request like this
HTTP::header replace "Host" "servername:5555"
and changing the URI with the HTTP::uri command
HTTP::uri "/directory[HTTP::uri]"
You may want to do something different with the uri but you get the point.
One other thing I noticied is that you took the host to contain the protocol (ie http://). This is not the case. The host is the section right after the protocol and before the first slash.
So for this uri: http://servername:5555/directory/index.txt, the value of HTTP::host is "servername:5555" and HTTP::uri is "/directory/index.txt".
BTW, in the future, you might want to post these types of questions to the iRules v9x forum as this forum is for questions regarding the iRules Editor application.
-Joe
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