Forum Discussion
Arie
Altostratus
May 05, 2008IE obeying - sometimes?
I've got an iRule that is supposed to redirect the browser to a new URL to ensure that the user is using "www" as a subdomain. Quite basic stuff. Works great in Firefox, but it's hit and miss in IE (esp. IE 6). Sometimes the browser follows the redirect and reposts the request with the www, sometimes the server comes back with "domain not found". The most bizarre event is when the redirect is to another domain and the browser (IE) manages to display the proper page while showing a domain in the address bar where the page certainly does not exist!
------------------------------------
when HTTP_REQUEST {
set enabled true
if { $enabled } {
if { not ([matchclass [string tolower [HTTP::host]] equals $::ExcludeFromWWWRedirect]) and not ([string tolower [HTTP::host]] starts_with "www") } {
HTTP::respond 301 Location http://www.[HTTP::host][HTTP::uri]
}
}
}
------------------------------------
HTTP Headers look fine (taken from Firefox):
http://domain.org/robots.txt
GET /robots.txt HTTP/1.1
Host: domain.org
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
HTTP/1.x 301 Moved Permanently
Location: http://www.domain.org/robots.txt
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
----------------------------------------------------------
http://www.domain.org/robots.txt
GET /robots.txt HTTP/1.1
Host: www.domain.org
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
HTTP/1.x 200 OK
Content-Length: 1068
Content-Type: text/plain
Content-Location: http://www.domain.org/robots.txt
Last-Modified: Thu, 23 Aug 2007 22:45:21 GMT
Accept-Ranges: bytes
Etag: "7bea2649d7e5c71:bd4c"
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Date: Tue, 06 May 2008 00:03:49 GMT
Connection: close
Vary: Accept-Encoding, User-Agent
Content-Encoding: gzip
3 Replies
- Colin_Walker_12Historic F5 AccountThat definitely sounds strange! The fact that it's working in FireFox leads me to believe that your iRule is set up properly, as far as the standards are concerned. I would probably take a look on Microsoft's site to see if there are any similar known issues with IE, as it sounds like they've got some different requirement or setting somewhere that's causing you this grief.
Colin - Arie
Altostratus
1)
Did that (used Wireshark). Redirects are coming back fine, although there's a checksum error. However, upon continually requesting the same URL eventually IE will follow the redirect - even though the checksum error still exists.
I did find a Microsoft bulletin about IE 4.x running into this problem if the redirect is split between frames. Haven't examined the frames yet.
2)
Since the response is coming back I assume that all is well. Need to convince the Sys Admin to give me console access...
3)
Tried that - no difference. Used HTTP::response, HTTP:redirect, with and without quotation marks, varied the response codes, etc. No difference.
However: I found that the problem is not limited to IE. Turns out that Firefox doesn't simply give up when it encounters the "host not found" error - it will retry with the subdomain "www". This masks the problem in FF.
In the meantime, I started suspecting that other iRules might be interfering. Apparently (can you confirm?) the Big-IP does not stop processing iRules when it encounters a redirect - if there are other iRules those will still be processed.
Adding "event disable all" right after the redirect seemed to have fixed at least this problem. - Yes, if you have multiple iRules assigned to your virtual, a HTTP::respond/redirect will not terminate processing of the rest of the iRules. An event disable should work but keep in mind that that will disable all event processing for that entire connection. Also, you may want to not do a "event disable all" as that will disable all events that you may or may not have iRules associated with. If you are using keep-alive connections then subsequent requests going over that same connection will not be processed. You can just disable the HTTP_REQUEST events by using "event disable" without the "all".
An alternative to disabling events to use session variables to maintain your state and then use conditional tests (if, etc) to determine if your variable is set. The best approach really depends on how you are setup.
-Joe
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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