Forum Discussion

Rodrihe's avatar
Rodrihe
Icon for Altocumulus rankAltocumulus
Mar 01, 2019
Solved

Forward with specific URI to pool without changing URL

Hi, DevCentral community!

I've been checking the forum and trying different answers from the community for other requests, but I haven't been able to do what I need to do, this is the scenario:

The client wants to receive the content of http://abc.com/xyz-xyz when he accesses through http://abc.com

In short, I need to forward the traffic to the pool with the URI /xyz-xyz but the URL has to be static as http://abc.com

Could anyone help me with the iRule?

when HTTP_REQUEST {

if { ([HTTP::host] eq "abc.com") } {
        if { ([HTTP::uri] equals "/") } {
        HTTP::uri "/xyz-xyz"
    }
    pool Client-pool
    text
    }

}

Thank all of you for your help and your time!

  • Hi,

    Instead of using an iRule, have you tried looking at using a rewrite profile instead?

    Something like this? (this rewrites http://abc.com to http://abc.com/xyz-xyz/)

    tmsh create ltm profile rewrite REWRITE rewrite-mode uri-translation uri-rules add { abc.com { type request client { scheme http host abc.com path / } server { path /xyz-xyz/ } } }

    tmsh modify ltm virtual  profiles add { REWRITE }

    • Note: You will need to make sure that there is an HTTP profile applied to the virtual server

3 Replies

  • HERE is the link I think you are looking for!

     

    Hope that helps! If it does please up-vote and select this answer, it would be greatly appreciated!

     

    -Dylan

     

  • Hi,

    Instead of using an iRule, have you tried looking at using a rewrite profile instead?

    Something like this? (this rewrites http://abc.com to http://abc.com/xyz-xyz/)

    tmsh create ltm profile rewrite REWRITE rewrite-mode uri-translation uri-rules add { abc.com { type request client { scheme http host abc.com path / } server { path /xyz-xyz/ } } }

    tmsh modify ltm virtual  profiles add { REWRITE }

    • Note: You will need to make sure that there is an HTTP profile applied to the virtual server