Forum Discussion
Tim_Cullen_8971
Nov 17, 2006Historic F5 Account
HTTP URI appending
I have looked through the posts and I see some "close" iRules but what I found hasn't worked.
The situation is this:
customer comes in to a site,
http://www.customer.com
The webserver used to redirect them to,
http://www.customer.com/customer_site_one
thus appending a uri on each connection request. There are a few different variations here but I can replicate for the extra uri's once I get this one to work.
The customer wants us to now do the redirect and switch them to SSL. For this, I did the standard http to https rewrite iRule on the port 80 VIP as below,
when HTTP_REQUEST {
HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri]
}
I then added the iRule below on to the 443 VIP,
when HTTP_REQUEST {
if { [HTTP::uri] equals "/"} {
[HTTP::uri] "/Customer_uri_one"
}
HTTP::header replace Host: customer.com
}
So to sum up. Customer comes in to http://www.customer.com. They should be pushed to https://customer.com/customer_uri_one.
I get a 404 error when I do this. Any ideas? I'm sure it is something silly that I am doing wrong but I wanted to check with the DevNinja's to see your Kung Fu.
TIA,
TC
4 Replies
- JRahm
Admin
Remove the brackets to set it, other wise it will return the value of HTTP::uri:when HTTP_REQUEST { if { [HTTP::uri] equals "/"} { HTTP::uri "/Customer_uri_one" } HTTP::header replace Host: customer.com }
I don't know if it matters in your situation, but the case that you are setting in the rule is different than what you posted for your expected redirection in relation to Customer_uri_one.
HTH - Tim_Cullen_8971Historic F5 AccountThat worked. I guess I was looking at it too long. Not sure what you mean by the last statement.
- Tim_Cullen_8971Historic F5 Accountabsolutely.
Thanks for the response. - Tim_Cullen_8971Historic F5 AccountActually, I guess I described it incorrectly. What you said is the expected behavior.
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