Forum Discussion
Need to redirect to an external url
We want our users to be redirected to a secondary external url when they access the first url.
For example: When our users go to https://application.ourdomain.com (which points to our F5), I want them to go to https://external.link.com
What do I put in the iRule? Thanks!
You may use this irule to do so.
when HTTP_REQUEST { if { [HTTP::host] equals "https://application.ourdomain.com" } { HTTP::respond 301 Location "https://external.link.com" } }
- Prash_BharadwajAltocumulus
You may use this irule to do so.
when HTTP_REQUEST { if { [HTTP::host] equals "https://application.ourdomain.com" } { HTTP::respond 301 Location "https://external.link.com" } }
- tolinrome_13817Nimbostratus
Thank you for replying.
Do I need to create a vip and redirect rule or just the vip? Does ssl client need to be enabled at all?
Also, the first url users will access is http not https, so I dont know if that matters where you wrote:
"equals "https://application.ourdomain.com" - should that be changed to http?
- Mike_G_is_1_134NimbostratusI don't think that you need to put the "https://" part into the if comparison. HTTP::host is just the host value, in your example "application.ourdomain.com". As an alternative, you could also use the HTTP::redirect function instead of responding with the 301. Just a suggestion.
- brightstar_uk_2Nimbostratus
Hi, I'm trying to setup something similar but getting an issue with the vserver being up.
I want to re-direct all 443 traffic from the vserver to an external url. 80 will just re-direct to 443. I think i'm ok with that but my virtual server is down. this is because it thinks the pool member(s) are down but there are no pool members as I just need it to re-direct to external.
my question is how do I get around this?
I tried to create a pool with no members and changed the Irule to show the following:
when HTTP_REQUEST { if { [active_members Pool_test] == 0 }{ HTTP::redirect "" } }
however, that still doesn't bring it up.
any help would be great
thanks in advance
- Hi, if you are using your virtual servers for redirection only there is no need to assign a pool. Having an iRule to redirect to the external location is just fine. Your virtual servers will remain in "blue" (unknown) state. No test for number of available servers is required. I hope I got your question right. Thanks, Stephan
- brightstar_uk_2Nimbostratus
perfect thank you for the quick response
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