Forum Discussion

Peter_L_71637's avatar
Peter_L_71637
Icon for Nimbostratus rankNimbostratus
Oct 14, 2013

Rewrite HTTPS URL

Hi, Is there anyone who can help me with the following problem?

 

My internal server is configured to access a URL: https://sample.domain.com/soap/ There is no possibility to change the above URL in the server (that would be to easy).

 

The supplier is changing the URL to https://sample.domain.com/soap/test/ I want to rewrite the URL in my F5 LTM through a VIP. Can anyone help me with a example iRule to do the trick? Greetings Peter

 

  • section from reply above. To change the URI, you can have the VIP iRule change that before your forward out. If the server does not respond to redirects like a browser:

    when HTTP_REQUEST { 
      if { [HTTP::uri] equals "/soap" } {
         HTTP::uri "/soap/test" 
      } 
    }
    
  • John_Alam_45640's avatar
    John_Alam_45640
    Historic F5 Account

    section from reply above. To change the URI, you can have the VIP iRule change that before your forward out. If the server does not respond to redirects like a browser:

    when HTTP_REQUEST { 
      if { [HTTP::uri] equals "/soap" } {
         HTTP::uri "/soap/test" 
      } 
    }
    
  • John_Alam_45640's avatar
    John_Alam_45640
    Historic F5 Account

    If i understand this correctly, your server acts as an HTTP 1.1 client and initiates a connection to https://sample.domain.com/soap and you want the URL to be: https://sample.domain.com/soap/test.

    To make configuration simple, you need to force your server to resolve the hostname to the IP address of a VIP on the bigIP.

    To change the URI, you can have the VIP iRule change that before your forward out. If the server does not respond to redirects like a browser: when HTTP_REQUEST { if { [HTTP::uri] equals "/soap" } { HTTP::uri "/soap/test" } }

    If the server DOES respond to redirects you can do this:

    when HTTP_REQUEST {
      if { [HTTP::uri] equals "/soap" } {
        HTTP::redirect "https://[HTTP::header host]/soap/test"
      }
    }
    

    Hope this helps. You may want to re phrase you question and include more details in case my reply does not answer it for you.

    • Peter_L_71637's avatar
      Peter_L_71637
      Icon for Nimbostratus rankNimbostratus
      Thanks for all the support. We solved this issue by a rewrite profile in version 11.4
  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus

    Peter,

     

    The replacement to HTTP Class profile in 11.4.x is the local traffic policy. See Local Traffic - Policies - Policy List. Assign this to the VS as you would've done for a http class profile.

     

    Hope this helps, N

     

  • You can just use a HTTP Class profile on your https Virtual Server and define the Host (sample.domain.com) and URI (/soap) with an action of redirect to your new URL (https://sample.domain.com/soap/test/).

     

    • Peter_L_71637's avatar
      Peter_L_71637
      Icon for Nimbostratus rankNimbostratus
      Unfortunately HTTP Class profile is not supported anymore on 11.4.0. I found KB http://support.f5.com/kb/en-us/solutions/public/14000/300/sol14381.html Thank you for the reply
  • You can just use a HTTP Class profile on your https Virtual Server and define the Host (sample.domain.com) and URI (/soap) with an action of redirect to your new URL (https://sample.domain.com/soap/test/).

     

    • Peter_L_71637's avatar
      Peter_L_71637
      Icon for Nimbostratus rankNimbostratus
      Unfortunately HTTP Class profile is not supported anymore on 11.4.0. I found KB http://support.f5.com/kb/en-us/solutions/public/14000/300/sol14381.html Thank you for the reply