Forum Discussion
Goran_Blomquis1
Nimbostratus
May 29, 2008rewrite host in redirect
Hi Devcentral and all users.
I have a case where I need to rewrite host in 302 redirect. It´s work fine but theres a lot of hosts behind the F5 and they need to keep hostname intact (not using hostname on VIP in redirect). My question are quite short. Is it possible to use woildcard in string command? So I rewrite to one host in location header, but keep URI in Location in the redirect? (I tried to pars host HTTP request and use that host in redirect and keep URI in location header but i faild).
So insted of
when HTTP_RESPONSE {
if { [HTTP::is_redirect] }{
HTTP::header replace Location "[string map {"A.internal.com" "X.external.com"} [HTTP::header Location]]"
}
}
I nedd to do somthing like
when HTTP_RESPONSE {
if { [HTTP::is_redirect] }{
HTTP::header replace Location "[string map {"*.*.*" "X.external.com"} [HTTP::header Location]]"
}
}
Is that possible?
Have a great day
Sunny hellos from Sweden
- hoolio
Cirrostratus
Hi, - hoolio
Cirrostratus
The regsub will replace /*.*.*/ with /x.external.com/ in the Location header value, so yes, the URI will be preserved. - Goran_Blomquis1
Nimbostratus
Great! - hoolio
Cirrostratus
http://.*?/ would indeed only match up to and including the first forward slash after the http://. I thought you only wanted to perform the replacement if there was a domain in the format of subdomain.domain.tld. - Goran_Blomquis1
Nimbostratus
Thanks for all help.
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects