Forum Discussion

sabdel_362193's avatar
sabdel_362193
Icon for Nimbostratus rankNimbostratus
Jan 15, 2019

External to internal redirection

Hello Everybody, Can you please help me, i want to redirect an URL ( External URL ) to another URL (internal URL published in a VS) ad if i must use an irule or just a policy redirection, Example: ---->

 

my greetings,

 

1 Reply

  • When you say redirect are you trying to send a HTTP redirect back to the client or are you trying to simply forward the traffic on to a different virtual server and update the HTTP Host header in the request?

    If you want to just forward from one Virtual Server to another you can use the

    virtual
    command the following is an example iRule to change the host header and forward to another Virtual Server named
    /partitionName/www.test2.com_vs
    but only if the host header in the client request is
    www.test1.com

    when HTTP_REQUEST {
      if {[string tolower [HTTP::host]] eq "www.test1.com"} {
        HTTP::header replace Host "www.test2.com"
        virtual /partitionName/www.test2.com_vs
      }
    }
    

    This does however comes with a whole set of issues you need to look at, like if the second Virtual Server returns HTML links with absolute path (i.e. includes the FQDN) you are likely to need to rewrite them with a STREAM profile. Also need to what out if you are performing SSL off-load on both Virtual Servers as the forward from the initial VS would create an SSL error.

    I am sure some other things to watch out for but depends on your configuration.