Forum Discussion
gerald_wegener_
Nimbostratus
Jun 12, 2006Eliminate redirects
In lieu of doing http redirects in the following example basic example:
--------
Client connects to http://abc.com and is redirected to http://www.abc.com
--------
would it be possible to eliminate the redirect in some fashion. For example:
1. Rewrite the request for abc.com to www.abc.com and submit it to the www.abc.com virtual.
2. Rewrite the response so the client now sees www.abc.com
Running ver 9.x
One goal here is to eliminate the time it takes for the client to get redirected and to reconnect to a new URL.
Thank You.
15 Replies
- hoolio
Cirrostratus
Hello, - Colin_Walker_12Historic F5 AccountAll you'd need to do is re-write the hostname when the client is making a request to the server. The server would then return a Location that includes that modified hostname, and subsequent requests should be sent to the address in the Location header.
when HTTP_REQUEST { if { not ( [HTTP::host] starts_with "www." ) } { HTTP::header replace Host "www.[HTTP::host]" } }
- gerald_wegener_
Nimbostratus
It's been awhile but I'm back on this. I tried the above iRule but it doesn't seem to rewrite the hostname. Here is the rule I'm using and some log entries that show it's not rewriting the hostname: - I've seen this before as well and I believe it just has to do with variable caching within the iRules engine. The header insert is taking place but it isn't updating the value of the HTTP::host variable. Have you verified that the host field being passed to your backend webserver isn't correct? I bet your server logs will show your rewritten value being sent.
- bl0ndie_127134Historic F5 AccountDoes the actual header that's sent to the server get modified? I wonder if [HTTP::host] is returning the old value.
- gerald_wegener_
Nimbostratus
- JRahm
Admin
Is there a reason the traffic MUST hit the other virtuals, or do you just need it to appear that it is? You can create multiple pools that reside behind a single virtual server, using an iRule to switch as necessary. You could use the session table to count current connections, and switch new connections to each pool accordingly with some math processing in your iRule. There are a lot of options... - gerald_wegener_
Nimbostratus
- unRuleY_95363Historic F5 AccountIn this case, I do think the pool chooser approach should be all you need to do though...
- gerald_wegener_
Nimbostratus
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