Forum Discussion

msaud's avatar
msaud
Icon for Cirrus rankCirrus
Sep 12, 2024

URL redirect

Hi Team,

Can someone please help me to build the irule script.

I have two VS 

VS1: vs_tableau.ucsf.edu_443

pool: pool_tableau.ucsf.edu_443

VS2: vs_tableauqa.ucsf.edu_443

pool:pool_tableauqa.ucsf.edu_443

 

I wanted to redirect the below URL:


FROM - https://tableau.ucsf.edu/#/site/QA/views/AllTableauDashboards/AllTableauDashboards

TO - https://tableauqa.ucsf.edu/#/site/QA/views/AllTableauDashboards/AllTableauDashboards

 

Note: This is single URL as of now but there would be multiple URL in future to redirect from 

tableau.ucsf.edu to tableauQA.ucsf.edu

 

  • Thanks Mo

     

    another example:

     

     


    https://tableau-snd.ucsf.edu/#/site/QA/views/ProjectChartfieldSearch/ProjectChartfieldSearch

    /#/site/QA/ : will be same 

    ProjectChartfieldSearch/ProjectChartfieldSearch : Can be anything

    Redirect to:
    https://tableauqa.ucsf.edu/#/site/QA/views/ProjectChartfieldSearch/ProjectChartfieldSearch

    • Hi, 

      I don't get you. 

      Have you applied the irule that I sent in my reply, this irule should redirect the hostname but keeps the rest of URI. 

       

      please clarify more 

      • msaud's avatar
        msaud
        Icon for Cirrus rankCirrus

        I didn't work.

        here is exact requirements:

         

        https://tableau-snd.ucsf.edu/#/site/QA/views/ProjectChartfieldSearch/ProjectChartfieldSearch

        /#/site/QA/ : will be same 

        ProjectChartfieldSearch/ProjectChartfieldSearch : Can be anything

        Redirect to:
        https://tableauqa.ucsf.edu/#/site/QA/views/ProjectChartfieldSearch/ProjectChartfieldSearch

  • Hi, 

    Use this iRule: 

    when HTTP_REQUEST {
      if { [HTTP::host] equals "tableau.ucsf.edu"} {
          HTTP::redirect "https://tableauqa.ucsf.edu[HTTP::path]"
        }
      }

    I haven't tested it, so check it and let me know. 

    Also you can do it using LTM policy , it much lightweight compared with irules and pretty much easy


    See this article it has the idea: https://my.f5.com/manage/s/article/K15117465