Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 
Custom Alert Banner

URL redirection

msaud
Altocumulus
Altocumulus
8 REPLIES 8

Hi @msaud , 
you can test the below irule : 

when HTTP_REQUEST {
  if { [HTTP::host] equals "tableau.ucsf.edu"} {
    if { [HTTP::path] contains "/Summary" or [HTTP::path] contains "/ZeroHarmDetail" or [HTTP::path] contains "/MetricDetail"} {
      HTTP::redirect "https://tableau.ucsf.edu/#/views/ZeroHarm2_0-Summary/Summary"
    }
  }
}


you can do it using LTM policy it will be much easier , if you need a help on it just tell me. 

I haven't tested this irule but it's correct as a syntax. 

these are some Articles should help in this : 

https://my.f5.com/manage/s/article/K15117465

https://my.f5.com/manage/s/article/K10112881

_______________________
Regards
Mohamed Kansoh

Thanks for your support.

 

I think we should go for "you can do it using LTM policy it will be much easier "

Okay dear @msaud  , 

you can configure it like this way : 

LTM++.PNG

No need to add host names , as I assume that this virtual server hosts only one hostname. 

Try it and let me know 

_______________________
Regards
Mohamed Kansoh

We have F5 VS FQDN is vip-tableau.ucsf.edu and tableau.ucsf.edu is alias.

Name: vip-tableau.ucsf.edu
Address: 10.67.XX.XX
Aliases: tableau.ucsf.edu

 

Hi @msaud , 

you should care with the FQDN " host name " that comes in each http request. 

_______________________
Regards
Mohamed Kansoh

CA_Valli
MVP
MVP

I'm a bit late and Mohamed already gave you a solution that should work,
I'd just like to point out -for additional clarity- that since this is encrypted traffic, you need to run both clientSSL and HTTP profiles on your service in order to perform content modification. If back-end servers expect encrypted packets, you should also use a serverSSL profile. 

Also, I don't know how many paths your web service is running, but I usually script "exact matches" when I have this type of request, to avoid disrupting (possibly) similar pages in different folders that don't need to be redirected. 

Here's my input: 

when HTTP_REQUEST {
  if {[string tolower [HTTP::host]] eq "tableau.ucsf.edu" && [HTTP::path] starts_with "/#/views/ZeroHarm"}{
    switch -glob [HTTP::path] {
      /#/views/ZeroHarm/Summary -
      /#/views/ZeroHarm/ZeroHarmDetail -
      /#/views/ZeroHarm/MetricDetail { HTTP::redirect "https://tableau.ucsf.edu/#/views/ZeroHarm2_0-Summary/Summary"}
    }
  }
}

 

RobertRalston
Nimbostratus
Nimbostratus

To achieve the URL redirection you described, you'll need to set up server-side redirects using your web server's configuration. The method may vary depending on your web server software. If you're using Nginx, you can use the provided configuration example with the necessary adjustments. If you have a different web server, refer to its documentation for redirection settings. Don't forget to back up your configuration file before making changes. 

lylawa
Nimbostratus
Nimbostratus

In summary, to achieve the URL redirection you want, set up server-side redirects based on your web server software. Use the  provided Nginx configuration example if applicable, or consult your web server's documentation for redirection instructions. Always remember to back up your configuration file before making changes for added security.