Forum Discussion
Irule for url redirection
Hi,
Can any one help me with a http url redirection : example : when a user types "abc.mydomain.com " he should be redirected to the URL "
thanks
4 Replies
- Harry_175563
Nimbostratus
HI can anyone help me on the above query - Michael_Jenkins
Cirrostratus
I think the best (most efficient) way to do this would be by using an LTM Policy to do the redirect. The following SOL document lists the steps to create a profile that will redirect HTTP requests to HTTPS, so you could just change some of the details to fit your requirements. https://support.f5.com/kb/en-us/solutions/public/14000/900/sol14996.html
Basically, in the condition, you would check
andhttp-host equals abc.mydomain.com
so it would only match an empty URI. Then you would do thehttp-uri equals /
.http-reply redirect location http://abc.mydomain.com:8080/update/manifest/Login.jsp - Michael_Jenkins
Cirrostratus
Tried to update my original response, but it didn't save right, so here's a copy of it again... nitass' response is what I intended. (So I'll paste it back in)
You could also use an iRule to accomplish this, though it's less efficient since this is a pretty basic requirement, and the built in functionality would work.
the iRule would look something like this:
when HTTP_REQUEST { if {[string tolower [HTTP::host]] equals "abc.mydomain.com" && [HTTP::uri] equals "/"} { HTTP::redirect "http://abc.mydomain.com:8080/update/manifest/Login.jsp" return You could also user HTTP::respond if you wanted more control over the response HTTP::respond 301 Location "http://abc.mydomain.com:8080/update/manifest/Login.jsp" } } - Michael_Jenkins
Cirrostratus
So it looks like the host header may have been keeping it from working? If you were interested, you could set some logging statements to see what the [HTTP::host] value. But since it's working, if you don't need hostname checking, then it's all good.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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