Forum Discussion
Kevan_50436
Nimbostratus
Apr 21, 2009Changing the body of a response
We have an application that builds and returns pages containing URLs as part of the response body based on how it was called. For example:
Called as: http://a.b.c.d/something/somethingelse
Response includes: http://a.b.c.d/something/changedhere
Called as: https://a.b.c.d/something/somethingelse
Response includes: https://a.b.c.d/something/changedhere
That is fine until SSL is offloaded to the LTM, when this happens:
Called as: https://a.b.c.d/something/somethingelse
Response includes: http://a.b.c.d/something/changedhere
I have found plenty of articles changing the header, but is it possible to change the body? Or maybe there is an alternate solution that I have missed.
Thanks,
Kevan.
- dennypayne
Employee
Hi Kevan, - Kevan_50436
Nimbostratus
Thanks for the idea. It did not fix the problem. - dennypayne
Employee
Sorry...I misread and thought that these references were 301 or 302 responses, but you're saying that the links are embedded in the payload (HTML or whatever). Fixing that is going to be a bit more complicated if the application isn't aware that it's being accessed by SSL on the front end. - Kevan_50436
Nimbostratus
That was the pointer I needed, thanks! - hoolio
Cirrostratus
Here are a few suggestions:when HTTP_REQUEST { Only rewrite responses if request is a GET if {[HTTP::method] eq "GET"}{ set rewrite_response 1 Prevent server from compressing response content if we're potentially going to rewrite it by removing the compression offerings from the client HTTP::header remove "Accept-Encoding" } else { set rewrite_response 0 } } when HTTP_RESPONSE { Check if the request was a GET and the response is a text content type if {$rewrite_response && [HTTP::header "Content-Type"] starts_with "text/"}{ Configure the find/replace for the stream filter and enable it STREAM::expression @http://@https://@ STREAM::enable } else { Disable the stream filter for this response STREAM::disable } }
- Kevan_50436
Nimbostratus
That is exactly what I needed. Thanks for the assistance!
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