Forum Discussion
Ian_Amos_37833
Nimbostratus
Aug 31, 2007URL rewrite..
Hello all,
here's what i'm trying to do:
There is a site with both internal and external URL's (INT dev.site.sub, EXT dev.site.net) where the external URL is fronted by an LTM. ...
Aug 31, 2007
Posted By IanAmos on 08/31/2007 7:00 AM
...
when HTTP_RESPONSE {
if { [HTTP::header exists "Location"] } {
if { [HTTP::header starts_with "http://dev.site.sub/siteminder"] } {
set remainder [substr [HTTP::header "Location"] 20]
HTTP::header replace "Location" "http://dev.site.net/siteminder/$remainder"
}
}
}
I get the following error in the logs:
http_process_state_prepend - Invalid action EV_EGRESS_DATA during ST_HTTP_PREPEND_HEADERS
...
I see a couple of issues with your code.
1. It seems that you have your second if statement incorrect. There is no "HTTP::header starts_with" command. I think you might have meant to compare the "Location" header with "http://dev.site.sub/siteminder".
2. Your substr command is pulling off everything past http://dev.site.sub/ so for a uri of "http://dev.site.sub/siteminder/foo/bar", remainder will be "siteminder/foo/bar" and your replacement header will be "http://dev.site.net/siteminder/siteminder/foo/bar" (notice the extra siteminder). If this is what you were intending, then ignore 2 but it kind of stuck out to me.
when HTTP_RESPONSE {
if { [HTTP::header exists "Location"] } {
1: compare Location header with uri
if { [HTTP::header "Location"] starts_with "http://dev.site.sub/siteminder" } {
set remainder [substr [HTTP::header "Location"] 20]
2: removed "siteminder/" from replacement string
HTTP::header replace "Location" "http://dev.site.net/$remainder"
}
}
}
Or, a more optimized version:
when HTTP_RESPONSE {
if { [HTTP::header exists "Location"] } {
if { [HTTP::header "Location"] starts_with "http://dev.site.sub/siteminder" } {
HTTP::header replace "Location" "http://dev.site.net/[substr [HTTP::header "Location"] 20]"
}
}
}
See if that fixes things up...
-Joe
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
