Forum Discussion
2 Replies
- Jose_TOVARNimbostratus
Hello everybody, I would like redirect host using datagroup leaving intact the URI.
domain.com/[$URI] -> [$URI]
orignately I had the following iRule. when HTTP_REQUEST { if { [class match [HTTP::host][HTTP::uri] eq datagrp_redirect] } { HTTP::redirect [class match -value [HTTP::host][HTTP::uri] eq datagrp_redirect ]
}
}
with following datagrp_redirect datagroup Configuration:
ltm data-group internal datagrp_redirect { records { domain-international.com/ { data https://www.domain-international.com } domain-usa.com/ { data https://www.domain-usa.com } bobo.ch/ { data https://www.domain.ch } bobo.fr/ { data https://www.domain.fr } } type string
Could be possible to insert URI variable within the datagroup record and take advantage of datagroup feature?
- RicoCirrus
First off, I personally think there are much better and easier ways to do what you are trying to accomplish here since it seems like all you need to do is prepend "; to your requests, but if you are partial to the system you have here, a simple change to your iRule will allow you to keep the URI intact.
when HTTP_REQUEST { if { [class match [HTTP::host]/ eq datagrp_redirect] } { HTTP::redirect [class match -value [HTTP::host]/ eq datagrp_redirect ][HTTP::uri] } }
I would highly recommend changing the iRule to be more general such as this:
when HTTP_REQUEST { if {[class match [HTTP::host][HTTP::uri] eq datagrp_redirect]} { HTTP::redirect https://www.[HTTP::host][HTTP::uri] } }