Forum Discussion

Mohamedabogamil's avatar
Mohamedabogamil
Icon for Nimbostratus rankNimbostratus
Nov 12, 2023

URL edit

Dear 

I need to send the request as is to the backend server but the client should see another URI and shouldn't see the port number but the same time port number shouldn't be modified when f5 sends this request to the backend servers

I have VS 1.1.1.1:4443 and backend servers work on 2.2.2.2:4443.

The URL is https:example.com:4443/OA_HTML/APPSlocalLogn.jsp 

I need to remove the word " local" and port 4443 from the URL  to be set it such as https:example.com/OA_HTML/APPSLogn.jsp 

Is there any way to make this request? 

Thanks 

  • Hi Mohamedabogamil , 

    Use this irule : 

    when HTTP_REQUEST {
    if {[HTTP::uri] starts_with "/OA_HTML/"} {
    HTTP::host [string map {":4443" ""}[HTTP::host]]
    HTTP::uri [string map {"local" ""}[HTTP::uri]]
    
    log local0. " the new URL >> [HTTP::host][HTTP::uri] "
    }
    }

    Note : iRules consume CPU cycles , so keep your eyes in your system resourses for any spikes after applying this irule. 

    This irule should meet your requirements and here below the output from /var/log/ltm file

    [root@bigipA:Active:Standalone] config # tac /var/log/ltm |grep -i "rule"  
    Nov 12 04:12:35 bigipA info tmm[16702]: Rule /Common/Replace <HTTP_REQUEST>:  the new URL >> 10.1.10.35/OA_HTML/APPSLogn.jsp 
    [root@bigipA:Active:Standalone] config # 


    I hope you find this insightful 🙂 

    • Mohamed_Ahmed_Kansoh's avatar
      Mohamed_Ahmed_Kansoh
      Icon for MVP rankMVP

      Mohamedabogamil , 

      If you need to omit the removed parts in the URL from appearing in the browser, 
      I believe you can use redirection and clone the same Virual server but with the https /443 port. 

      here this editied irule : 

      when HTTP_REQUEST {
      if {[HTTP::uri] starts_with "/OA_HTML/"} {
      HTTP::host [string map {":4443" ""}[HTTP::host]]
      HTTP::uri [string map {"local" ""}[HTTP::uri]]
      log local0. " the new URL >> [HTTP::host][HTTP::uri] "
      HTTP::redirect "https://[HTTP::host][HTTP::uri]"
      }
      }
    • Mohamedabogamil's avatar
      Mohamedabogamil
      Icon for Nimbostratus rankNimbostratus

      Hi Mohamed thanks for the replay i will explain the problem in a better way

       I need to send the request as is to the backend server

      (The URL is https:example.com:4443/OA_HTML/APPSlocalLogn.jsp )

      but the client should see another URI and shouldn't see the port number

      (The URL is https:example.com/OA_HTML/APPSLogn.jsp )

      but same time port number shouldn't be modified when f5 sends this request to the backend servers

      did your solution match with this scenario 

  • Hi Mohamedbogamil,

    So i think you can using this step for ror this solution,

    1. on virtual server you can use service port 443 and check port translate on virtual server for translate to member port 4443

    2. Try irule about http replace uri

    I hope this step will help you

    Best Regards