Need help on wildcard redirect iRule
We need to an iRule to redirect traffic from
https://abc.test.com/*
https//*.abc.test.net
Here is the iRule
when HTTP_REQUEST { scan [HTTP::uri] %[^.]%[^.] prefix uri log local0. "$uri" set original_uri [HTTP::uri] set append [getfield [string range [HTTP::uri] 1 end] "$prefix" 1] if {[HTTP::host] equals "abc.test.com" } { set host [string map {abc.test.com abc.test.net} [HTTP::host]] HTTP::header replace Host $append.$host$uri } } when HTTP_RESPONSE { if { [HTTP::header exists Location] } { regsub "$append.abc.test.net" [HTTP::header Location ] "abc.test.com" newlocation HTTP::header replace Location $newlocation$original_uri } }
Can you please let me know what we did wrong?
Thank you very much in advance!
William Sun