Forum Discussion

Fernando_M's avatar
Fernando_M
Icon for Altocumulus rankAltocumulus
Jun 23, 2023

How to create F5 home page with redirection URLs

Hello F5 community,

I'm wondering if we can create/implement or host an home web page with F5 Big-IP load balancer, the idea is to have a home page that it will be accessible via: https://www.homepage.local for example, at this basic home page we need to put 02 Urls which redirects to two different URLs (or solutions) like: https://www.solution01.local and https://www.solution02.local, each solution or service URL will be attached to one virtual server who is already created and contain 02 web servers

Example of desired home page:

My question, do we need to separated reverse proxy to host the main page or we can implement this through F5 Big-IP

NB/ The current solution is deployed within reverse proxy where load balancing don’t exist

Thanks in advance for all

5 Replies

  • Fernando_M Depending on how long your html code is you could probably use the following which shows a generic sorry page for when a pool is down. In your situation you can make the argument be a general response rather than making it based on active pool members.

    when HTTP_REQUEST priority 500 {
    
        if { [active_members [LB::server pool]] == 0 } {
            HTTP::respond 200 content {
    
                <html>
                <head>
                <title>Page Not Found</title>
                </head>
                <body>Page Not Found</body>
                </html>
    
            }
        }
    
    }

     

    • Fernando_M's avatar
      Fernando_M
      Icon for Altocumulus rankAltocumulus

      PauliusThank you first for your feedback, in fact yes I need to make this page display automaticly when user type https://www.homepage.local and limitied by time like maintenance pages

      I will try this proposal with adding HTML code of existing home page that we have and let you know

      Thank you again for your support

      • Paulius's avatar
        Paulius
        Icon for MVP rankMVP

        Fernando_M You're welcome. Keep in mind that you most likely shouldn't put much on the F5 for serving websites because it's not really a webserver but for simple sites for maintenance pages, site down pages, or general informational pages it's okay but it shouldn't be a full blown website. Ideally you should forward this request to a specific server that would respond with this page and then when the request comes back through the F5 then the F5 can make a load balancing decision based on the host and/or URI path. It is possible to serve images on this generic site by base64 encoding the file and then referencing that file on the F5 but really you should try not to do this.

  • Hi Fernando_M , 
    I have written this  irule for you , it as follow : 

     

     

    when HTTP_REQUEST {
       HTTP::respond 200 content {
          <html>
             <head>
             </head>
             <title>https://www.homepage.local</title>
             <body>
               <h1>Click one of below Links and enjoy</h1>
             </body>
             
             <body>
             <p>
               <a href="https://www.solution01.local">Solution 01</a>
               
               This is for https://www.solution01.local
             </p>
             </body>
             <head>
             
             </head>
             <body>
             <p>
               <a href="https://www.solution02.local">Solution 02</a>
                This is for https://www.solution02.local
             </p>
             </body>
             
          </html>
       }
    }

     

     

    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Create the below >> 
    1) Two separate Virtual servers for Solution 1 and Solution 2 and attach the required pools as you mentioned in your inquiry. 
    2) the irule will embed these urls in the web page and will be depend on your choice ( Solution 01 or Solution 02 ) 
    3) Create The main Virtual server for this url   https://www.homepage.local and map it to main virtual server IP. 
    you will need only to add assign http profile / Client ssl if there is ssl and attach the above irule to it without pools or anything else. 
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    you should see the below web page after when enter https://www.homepage.local 


    According to my code : Solution 01 >>> includes embeded https://www.solution01.local & Solution 02 >>> includes embeded https://www.solution02.local 

    you can Customize according your environment. 

    Finally this is should be your traffic Flow : 



    I tested each step and it worked with me. 
    Some hints : 
    >> Don't forget to make sure that https://www.solution01.local  Resolves to Solution01_VS IP &  https://www.solution02.local  Resolves to Solution02_VS IP. 

    >> you can Customize your ( Solution01_VS & Solution02_VS ) to single virtual server , but you will need to create another iRule to select proper pool depending on the " Hostname " that comes in the request. 

    Please Test it and let me know how it works with you 🙂