Forum Discussion
STREAM::expression Not Replacing All Occurrences
Here's the iRule:
when HTTP_REQUEST { ... }
when HTTP_RESPONSE {
STREAM::disable
if { [HTTP::header Content-Type] starts_with "text/" }{
STREAM::expression "@https://somedomain.com@@ @http://anotehrdomain.com@@"
STREAM::enable }
}
In my test that has 93 occurrences of https://somedomain.com in the response stream, 91 occurrences were replaced, but two were not. They're not the same occurrences all the time. Sometimes only 1 isn't replaced, sometimes 3.
I've tried using regexp but same result.
I'd appreciate any information.
Thanks, Jeff
- hooleylistCirrostratusHi Jeff,
- Kris__109062NimbostratusI appear to be having exactly the same issue.
- Ken_Nowell_6806NimbostratusI seem to be experiencing the same issue. Has anyone identified a solution? Here's a copy of my iRule. I can also provide the original and modified responses if need be.
when HTTP_REQUEST { Explicitly disable the stream profile for each request so it doesn't stay enabled for subsequent HTTP requests on the same TCP connection. STREAM::disable } when HTTP_RESPONSE { Apply stream profile against text or javascript responses from the application if { [HTTP::header value Content-Type] contains "text" || [HTTP::header value Content-Type] contains "javascript" }{ Replace /webcenter/spaces/MortgageCenter/page/ with /MortgageCenter/page/ Replace /webcenter/oracle/webcenter/siteresources/scopedMD/ with /MortgageCenter/siteresources/scopedMD/ Replace /webcenter/faces/oracle/webcenter/page/scopedMD/ with /MortgageCenter/page/scopedMD/ Replace /webcenter/faces/ with /MortgageCenter/faces/ Replace /webcenter/adf/ with /MortgageCenter/adf/ Replace /webcenter/afr/with /MortgageCenter/afr/ Replace /webcenter/sessioninvalidation with /MortgageCenter/sessioninvalidation Replace /webcenter/oracle/webcenter/webcenterapp/view/templates/publichtml/ with /MortgageCenter/publichtml/ STREAM::expression {@/webcenter/spaces/MortgageCenter/page/@/MortgageCenter/page/@ @/webcenter/oracle/webcenter/siteresources/scopedMD/@/MortgageCenter/siteresources/scopedMD/@ @/webcenter/faces/oracle/webcenter/page/scopedMD/@/MortgageCenter/page/scopedMD/@ @/webcenter/faces/@/MortgageCenter/faces/@ @/webcenter/adf/@/MortgageCenter/adf/@ @/webcenter/afr/@/MortgageCenter/afr/@ @/webcenter/sessioninvalidation@/MortgageCenter/sessioninvalidation@ @/webcenter/oracle/webcenter/webcenterapp/view/templates/publichtml/@/MortgageCenter/publichtml/@} Enable the stream profile STREAM::enable } If the response contains the Set-Cookie header, rewrite the context root if { [HTTP::header value Set-Cookie] contains "/webcenter" }{ HTTP::header replace Set-Cookie [string map "/webcenter /" [HTTP::header value Set-Cookie]] } If the response is a redirect rewrite the Location header. Replace /webcenter/spaces/MortgageCenter/page/ with /MortgageCenter/page/ Replace /webcenter/oracle/webcenter/siteresources/scopedMD/ with /MortgageCenter/siteresources/scopedMD/ Replace /webcenter/faces/oracle/webcenter/page/scopedMD/ with /MortgageCenter/page/scopedMD/ Replace /webcenter/faces/ with /MortgageCenter/faces/ Replace /webcenter/adf/ with /MortgageCenter/adf/ Replace /webcenter/afr/ with /MortgageCenter/afr/ Replace /webcenter/sessioninvalidation with /MortgageCenter/sessioninvalidation Replace /webcenter/oracle/webcenter/webcenterapp/view/templates/publichtml/ with /MortgageCenter/publichtml/ if { [HTTP::is_redirect] }{ HTTP::header replace Location [string map "/webcenter/spaces/MortgageCenter/page/ /MortgageCenter/page/ /webcenter/oracle/webcenter/siteresources/scopedMD/ /MortgageCenter/siteresources/scopedMD/ /webcenter/faces/oracle/webcenter/page/scopedMD/ /MortgageCenter/page/scopedMD/ /webcenter/faces/ /MortgageCenter/faces/ /webcenter/adf/ /MortgageCenter/adf/ /webcenter/afr/ /MortgageCenter/afr/ /webcenter/sessioninvalidation /MortgageCenter/sessioninvalidation /webcenter/oracle/webcenter/webcenterapp/view/templates/publichtml/ /MortgageCenter/publichtml/" [HTTP::header value Location]] } }
- hooleylistCirrostratusHi Ken,
Don't allow response data to be chunked if { [HTTP::version] eq "1.1" } { if { [HTTP::header is_keepalive] } { HTTP::header replace "Connection" "Keep-Alive" } HTTP::version "1.0" }
- Ken_Nowell_6806NimbostratusThanks Aaron. Yes, the server is sending a chunked response, but there is no compression enabled. I'm using a modified HTTP Profile that uses the default HTTP Profile as it's parent, the only change in the new profile was to set Response Chunking to rechunk. If I use your suggestion to prevent chunking via the iRule with the new HTTP Profile the page load doesn't complete. If I disable chunking via the iRule and use the default HTTP Profile the page load completes but I'm still experiencing the issue where not all occurrences are bring replaced.
- hooleylistCirrostratusCan you set the HTTP version to 1.0 in the iRule and use a custom HTTP profile with response chunking set to rechunk?
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