Forum Discussion
Mulitple URL Replace and stream profile
I have a case where the internal naming of multiple servers have to be replaced by a single FQDN. I am succesful when dealing with one instance but not with many. Here is my current iRule, note: it seems to never hit on the second object.
when HTTP_RESPONSE {
if { [HTTP::is_redirect]} {
HTTP::header replace Location "[string map -nocase [list inside1.net fqdn.com] [HTTP::header value Location]]"
} else {
HTTP::header replace Location "[string map -nocase [list inside2.net fqdn.com] [HTTP::header value Location]]"}
}
Also; I have a stream profile applied to the VIP:
Source is blank.
Target: @inside1.net@fqdn.com@ @inside2.net@fqdn.com@
Any help would be much appreciated!
18 Replies
- What_Lies_Bene1
Cirrostratus
Can you try this please? I've added some spaces (which probably won't help) and some logging that might;when HTTP_RESPONSE { if { [HTTP::is_redirect] } { HTTP::header replace Location "[string map -nocase [list inside1.net fqdn.com] [HTTP::header value Location]]" } else { log local0. "Changing inside2.net location header" HTTP::header replace Location "[string map -nocase [list inside2.net fqdn.com] [HTTP::header value Location]]" } }
- zipperbox_11405
Nimbostratus
Thanks. Tried it and again it only works for the first item, in this case it replaced inside1.net to fqdn.com but it always seems to fail on the following item(s) no matter the order. - What_Lies_Bene1
Cirrostratus
OK, so how about we make it real simple;when HTTP_RESPONSE { if { [HTTP::is_redirect] } { HTTP::header replace Location "fqdn.com" } else { log local0. "Changing inside2.net location header" HTTP::header replace Location "fqdn.com" } }
- What_Lies_Bene1
Cirrostratus
Btw, is the Stream profile working OK? - nitass
Employee
e.g.[root@ve10:Active] config b virtual bar80 list virtual bar80 { snat automap pool foo destination 172.28.19.252:80 ip protocol 6 rules myrule profiles { http {} tcp {} } } [root@ve10:Active] config b pool foo list pool foo { members 200.200.200.101:80 {} } [root@ve10:Active] config b rule myrule list rule myrule { when HTTP_RESPONSE { if { [HTTP::is_redirect]} { HTTP::header replace Location "[string map -nocase [list inside1.net fqdn.com inside2.net fqdn.com] [HTTP::header value Location]]" } } } original response [root@ve10:Active] config curl -I http://200.200.200.101/something1 HTTP/1.1 302 Found Date: Tue, 15 Jan 2013 04:17:33 GMT Server: Apache/2.2.3 (CentOS) Location: http://inside1.net/somethingone Content-Type: text/html; charset=iso-8859-1 [root@ve10:Active] config curl -I http://200.200.200.101/something2 HTTP/1.1 302 Found Date: Tue, 15 Jan 2013 04:17:34 GMT Server: Apache/2.2.3 (CentOS) Location: http://inside2.net/somethingtwo Content-Type: text/html; charset=iso-8859-1 response through bigip [root@ve10:Active] config curl -I http://172.28.19.252/something1 HTTP/1.1 302 Found Date: Tue, 15 Jan 2013 04:19:27 GMT Server: Apache/2.2.3 (CentOS) Location: http://fqdn.com/somethingone Content-Type: text/html; charset=iso-8859-1 [root@ve10:Active] config curl -I http://172.28.19.252/something2 HTTP/1.1 302 Found Date: Tue, 15 Jan 2013 04:19:28 GMT Server: Apache/2.2.3 (CentOS) Location: http://fqdn.com/somethingtwo Content-Type: text/html; charset=iso-8859-1
- zipperbox_11405
Nimbostratus
Thanks - but unfortunately neither of these suggestions worked. The following was really close but didn't quite like the directories. - nitass
Employee
but unfortunately neither of these suggestions worked. hmm... would you mind showing us what is not working? - zipperbox_11405
Nimbostratus
When using the following iRule: - hoolio
Cirrostratus
You're replacing the Location header with just fqdn.com. The browser assumes that means it should make a new GET request to it's current host/URL + fqdn.com. If they'd requested http://www.example.com/path, they'd make a new request to http://www.example.com/path/fqdn.com which isn't what you want. - zipperbox_11405
Nimbostratus
So this irule is very very close...
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