Forum Discussion
PacketHead_4009
Nimbostratus
Feb 17, 2010Simple redirect ?
Ok, this probably doesn't qualify for Adv Configuration but I couldn't find a spot where this question would fit.
How I can create a redirect so that if a user tries to go to:
http://webmail.mysite.com
that is redirects them to:
http://webmail.mysite.com/home/mail/default/
Also I would prefer that it redirects them to https instead of http.
so basically two things:
if a user goes to https://webmail.mysite.com it will redirect to https://webmail.mysite.com/home/mail/default/
and
if a user goes to http://webmail.mysite.com it will HTTP to HTTPS rediect to
https://webmail.mysite.com/home/mail/default/
is executing both of these requirements possible ?
- The_Bhattman
Nimbostratus
Hi Jcribb,when HTTP_REQUEST { HTTP::redirect "https://webmail.mysite.com/home/mail/default/" }
when HTTP_REQUEST { if { ([HTTP::Host] eq "webmail.mysite.com") and ([HTTP::uri] eq "/") } { HTTP::redirect "https://webmail.mysite.com/home/mail/default/" } }
- PacketHead_4009
Nimbostratus
Thanks Bhatty, - PacketHead_4009
Nimbostratus
Hello Bhatty, - L4L7_53191
Nimbostratus
There's a missing paren - try this:when HTTP_REQUEST { if {([HTTP::Host] eq "webmail.mysite.com") and ([HTTP::uri] eq "/")} { HTTP::redirect "https://webmail.mysite.com/home/mail/default/" } }
- PacketHead_4009
Nimbostratus
Ok it took it now. But when I apply that to the virtual server it doesn't work. - hoolio
Cirrostratus
If you're seeing an immediate failure, it could be a TCP reset being sent when a runtime TCL error is hit. Can you check /var/log/ltm for any TCL errors? - PacketHead_4009
Nimbostratus
No TCL errors ... log is clean. - hoolio
Cirrostratus
Can you add logging to the iRule and check the log output in /var/log/ltm to see what's happening in the rule?when HTTP_REQUEST { log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::method] request to [HTTP::host][HTTP::uri]" if {([HTTP::host] eq "webmail.mysite.com") and ([HTTP::uri] eq "/")} { log local0. "[IP::client_addr]:[TCP::client_port]: Redirecting to https://webmail.mysite.com/home/mail/default/" HTTP::redirect "https://webmail.mysite.com/home/mail/default/" } }
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