Forum Discussion
irule redirect and masking
Hi Im having trouble with an irule I hope you can help.
Im trying to have request that goes to host with /external* redirects to another site but the rul is masked with original request
A request to https://Mainsiteurl.site.com.au/extranet/folder/folder/aphandbook.htm should go to http://extranet.site.com.au/folder/folder/aphandbook.htm . In the browser however it will show as original request https://Mainsiteurl.site.com.au/extranet/folder/folder/aphandbook.htm
Is this possible? and if so could someone help with the rule
I have got but dont have a sandbox environment to test on
"/extranet*" { SSL::disable serverside
HTTP::uri "/[string range $uri 9 end]" log local0. " extranet $uri" HTTP::header replace "Host" "extranet.site.com.au" }
3 Replies
- Brett__01_13258
Nimbostratus
OK redirection is working fine now just need to keep the original URL. any thoughts would be appreciated? thanks
when HTTP_REQUEST {
if {[string tolower [HTTP::uri]] starts_with "/extranet"}{set new_uri [string map {"/extranet" ""} [HTTP::uri]] HTTP::redirect "http://extranet.site.com.au$new_uri" } }
- nathe
Cirrocumulus
Brett,
How about changing your 2nd example so once you've set the new_uri do a replace header and then change ur. Something like:
HTTP::header replace "Host" "extranet.site.com.au"
HTTP:: uri "/$new_uri"
Might that work?
- Kevin_Stewart
Employee
A redirect to "http://extranet.site.com.au" will cause the browser to show that address. If you want to keep the browser on "https://Mainsiteurl.site.com.au", then your first iRule code was probably more appropriate. That is, instead of physically redirecting the user to another host, you must send the traffic through the Mainsite VIP.
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] starts_with "/extranet" } { HTTP::uri "/[string range [HTTP::uri] 9 end]" HTTP::header replace Host "extranet.site.com.au" pool extranet_pool SSL::disable serverside } }The above assumes that the Extranet service is in a different pool of servers than your regular traffic, and that your regular pool of servers are listening on SSL.
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