Forum Discussion

neilclark's avatar
neilclark
Icon for Nimbostratus rankNimbostratus
Feb 01, 2018

irule to redirect http URL to a server URL

Hi Guys,

Hope you may be able to help,

I have the following scenario.

I have a DNS entry test.acb.xyz/TE and this maps to an LTM Vip with a Load balanced server behind it.

however the webpage is not hosted on the default place and the request needs to be sent on to to get to the correct page.

I understand that i need an irule to do this but wanted to make sure i am going to configure the correct type. Below is what i have worked out from another previous irule that stream rewrites. I am not sure if this is what i want or not.

when HTTP_REQUEST priority 100 { set pre_filter_substr "XYZ.net" set after_filter_substr "XYZ.com"

Enable the stream filter for text responses only if {[HTTP::header value Content-Type] contains "text"} { create a STREAM expression to replace

STREAM::expression {@HTTP://test.abc.xyz;/TE@http://Server1;8080;/ABC2

    STREAM::enable;

}

when HTTP_RESPONSE priority 100 { set pre_filter_substr "XYZ.net" set after_filter_substr "XYZ.com"

Enable the stream filter for text responses only if {[HTTP::header value Content-Type] contains "text"} { create a STREAM expression to replace

STREAM::expression {@http://Server1;8080;/ABC2@HTTP://test.abc.xyz;/TE enable STREAM STREAM::enable

} }

I am very new to iRules so any info would be greatly appreciated.

Thanks

Neil