Sep 2026 - DevCentral will be set to Read-Only on Sep 14th for a platform update. Details: DevCentral is Evolving.

Forum Discussion

VS's avatar
VS
Icon for Nimbostratus rankNimbostratus
Jul 09, 2020
Solved

redirect with variable uri

Hi,   Newbie to F5 working on my first irule and already stuck. I have an irule similar to below which works. But now need to modify it with part of the URI "123456" being variable and redirected...
  • Dario_Garrido's avatar
    Jul 15, 2020

    Hello VS.

    Try this.

    when HTTP_REQUEST {
    	set uri_param [URI::query [HTTP::uri] uri]
    	if { ([HTTP::host] contains "website1") and ([string tolower [HTTP::uri]] starts_with "/hptrimwebclient/download/") } {
    		HTTP::redirect "http://website2.com/CS/HPRMServiceApi/Record/$uri_param/File/Document"
    	}
    	else { pool POOL1 }
    }

    Regards,

    Dario.