Forum Discussion
Tom_Thunem_9204
Nimbostratus
Oct 12, 2009URL redirect when URL is lacking a domain name
Hello,
I have a situation where they want to save the user some typing. They want to redirect http://abc to http://abc.com. Haven't been able to find the syntax for this. All of my rules assume the domain was entered. Whatever the solution is, I assume the abc.com URL will carry to the downstream VIP's and other apps that require the appended domain name.
Thanks.
- Is this on an intranet environment where "abc" will be resolved by a name lookup? Assuming that's the case, then as long as the host IP for "abc" is configured as a virtual server on the BIG-IP, you could create an iRule like this:
when HTTP_REQUEST { if { [HTTP::host] eq "abc" } { HTTP::header replace "Host" "abc.com" } }
- Tom_Thunem_9204
Nimbostratus
here is the iRule I have built. It doesn't seem to be working as the FQDN doesn't appear to be getting passed on to the authentication piece of our app. In the browser, the user enters "http://chargeit", they are then taken to a login screen. That screen requires the FQDN for authentication. That being "chargeit-test.avnet.com". - hoolio
Cirrostratus
You could add logging to the iRule and use a browser plugin like HttpFox for Firefox or Fiddler for IE to view the client to VIP communication.when HTTP_REQUEST { log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::method] request to [HTTP::host][HTTP::uri]" Check if host is chargeit-test if { [HTTP::host] eq "chargeit-test" } { log local0. "[IP::client_addr]:[TCP::client_port]: Replacing host header." Replace the Host header HTTP::header replace "Host" "chargeit-test.avnet.com" } }
- Tom_Thunem_9204
Nimbostratus
here's what I have thus far. Same results if I use double-quotes around Host in replace statement. - hoolio
Cirrostratus
The HTTP::host value is cached, but the update is still done. If you want to see the effect of the change you could either check the server logs or log the value in a later priority HTTP_REQUEST event:when HTTP_REQUEST { log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::method] request to [HTTP::host][HTTP::uri]" Check if host is chargeit-test if { [HTTP::host] eq "chargeit-test" } { log local0. "[IP::client_addr]:[TCP::client_port]: Replacing host header." Replace the Host header HTTP::header replace "Host" "chargeit-test.avnet.com" } } when HTTP_REQUEST priority 501 { log local0. "[IP::client_addr]:[TCP::client_port]: (501) [HTTP::method] request to [HTTP::host][HTTP::uri]" }
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