Forum Discussion
URI redirection
The traffic on http://url1.us.com:8443/Wireless/Wi...ageService should be forwarded to http://url22.us.com:8443/my/msg/out...ageService.
only host header needs to be changed
i tried the below but no luck
when HTTP_REQUEST {
if { ([HTTP::uri] equals "/Wireless/WirelessOutboundMessageService") } {
HTTP::uri "/my/msg/outbound/wireless/WirelessOutboundMessageService"
HTTP::header replace "Host" "url22.us.com:8443"
}
}
6 Replies
- Kevin_Stewart
Employee
Where and how is it failing? Are url1 and url22 on the same server? - Vadiraj_95604
Nimbostratus
Hi,
No both URLs are different VIPs.
i am getting an additional / on the forwarded URI, hence a 404 error
- Kevin_Stewart
Employee
Can you elaborate on what you're trying to do? I take it that you have two VIPs (url1 and url22) with the same iRule, doing essentially the same thing - changing the incoming URI and Host header? And that you appear to be getting an additional "/" in the URI arriving at the server(s)? - Vadiraj_95604
Nimbostratus
Hi,
url1 is a old version of the app and url22 is new version, hence any traffic which will be hitting old version of app needs to be forwarded to new version of app
yes url1 and url22 are different VIPs
below is the log from web server, if you observe closely one additional / is getting added at the beginning of the uri
- Vadiraj_95604
Nimbostratus
- Kevin_Stewart
Employee
I have to say, unless there's a bug with HTTP::uri in your specific TMOS version, there has to be something else going on between the client and server. Lets try a little logging.when HTTP_REQUEST { log local0. "Incoming URI = [HTTP::uri]" if { ([HTTP::uri] equals "/Wireless/WirelessOutboundMessageService") } { log local0. "Caught URI and changing" HTTP::uri "/my/msg/outbound/wireless/WirelessOutboundMessageService" HTTP::header replace "Host" "url22.us.com:8443" } } when HTTP_RESPONSE { if { [HTTP::header exists Location] } { log local0. "redirect to [HTTP::header Location]" } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com