Forum Discussion

Alanwat_138254's avatar
Alanwat_138254
Icon for Nimbostratus rankNimbostratus
Mar 07, 2014

URI rewrite

All,

 

I am setting up a virtual server for an internal group. They want to be able to go to an address like "http://assetsuite:9080" and be sent to "http://assetsuire:9080/PROD/Domain" The VIP is set up as "performance(HTTP)" and I have written an iRule to do the URI rewrite, but it isn't working...little help?

 

when HTTP_REQUEST { if { not ([HTTP::uri] == "/PROD/domain") } { HTTP::uri /PROD/domain[HTTP::uri] } }

 

2 Replies

  • Hi!

    The rule you have would make ie an uri that's "/PROD/domain/mypage.aspx trigger on the if condition.

    If you want to make sure all uris starts with /PROD/domain/ you could try this one:

    when HTTP_REQUEST { 
        if { not ([HTTP::uri] starts_with "/PROD/domain") } { 
            HTTP::uri /PROD/domain[HTTP::uri] 
        } 
    }
    

    This would rewrite /myuri to /PROD/domain/myuri.

    Good luck!

    /Patrik

  • That got me on the right track. Some of the page elements weren't loading though, and a httpwatch trace showed me that some of the elements were in a different directory. The following rule worked perfectly.

     

    when HTTP_REQUEST { if { not ([HTTP::uri] starts_with "/PROD") } { HTTP::uri /PROD/domain[HTTP::uri] } }