Forum Discussion
Kim_Scarborough
Nimbostratus
Dec 01, 2005iRule "domain" truncating
I've been using the iRule "domain" command in a variety of iRules. I've been having problems with it, and I finally figured out that it is truncating the last letter, for some reason. I created a special, simplified iRule to illustrate the problem:
when HTTP_REQUEST {
if { [HTTP::host] ends_with "example.com" } {
HTTP::respond 403 X-Domain [ domain [HTTP::host] 2 ]
}
}
Here's an HTTP session transcript for the VIP with that iRule:
GET /poop HTTP/1.1
Host: www.example.com
HTTP/1.0 403 Forbidden
X-Domain: example.co
Server: BIG-IP
Connection: Keep-Alive
Content-Type: text/html
Content-Length: 0
Shouldn't "X-Domain" be returning "example.com", not "example.co"? Or is there something I've missed here?
- Colin_Walker_12Historic F5 AccountI'm pretty sure the domain command should just return the domain parts that you specify. There shouldn't be any truncation that I know of.
- Kim_Scarborough
Nimbostratus
I'm not looking for the full hostname. I only want the domain name to be returned. In this example, I want it to take "www.example.com" or "foo.bar.example.com" and have it return "example.com". - Colin_Walker_12Historic F5 AccountThat's interesting. It certainly appears as though you're using the command properly. I'll have to take a look and see if I'm seeing the same behavior. What version are you running?
when HTTP_REQUEST { if { [HTTP::host] ends_with "example.com" } { HTTP::respond 403 X-Domain [join [lrange [split [HTTP::host] "."] end-1 end] "."] } }
- unRuleY_95363Historic F5 AccountThis does appear to be a bug. CR57448 has been filed.
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