Forum Discussion
Rewriting Javascript w/o APM
Setup: BIG-IP 11.5.1 w/ LTM/AVR/AAM (note: APM is not licensed and currently disabled because it is not required)
We have a requirement to put a virtual server (SSL) in front of an Oracle User Productivity Kit (UPK) server (SSL). The launch page is https://server/kcenter/ which successfully displays a list of content (training material) for the user to select.
The http profile is configured to 'redirect rewrite: all'.
When the user clicks a link, the user is redirected to the back-end server of https://realserver/kcontent/x/data/toc.html where 'x' is an index of an interactive training material. This should not occur.
I'm sure I need to rewrite the Javascript, but the only rewrite method available is URI translation. I've tinkered with a stream profile with no success.
What am I missing?
4 Replies
- Kevin_Stewart
Employee
Not sure how far you've gotten with the STREAM profile approach, but that is probably your best approach.
when HTTP_REQUEST { HTTP::header remove Accept-Encoding STREAM::disable } when HTTP_RESPONSE { if { [HTTP::header Content-Type] contains "text" } { STREAM::expression {@realserver@server@} STREAM::enable } }
You may need to fine tune this search-replace, but the idea is to replace any instance of realserver in the response with the external server name. If you need to also rewrite complex URI patterns, you may want to consider either the ProxyPass iRule (11.3 and below) and rewrite profiles in 110.4 and above).
- Gilles_Archer_3
Nimbostratus
Thanks for the quick response, Kevin.
I do have a child stream profile assigned w/ default source & target assigned to the VS. And the iRule is exactly as you described:
when HTTP_REQUEST { HTTP::header remove Accept-Encoding STREAM::disable } when HTTP_RESPONSE { if { [HTTP::header Content-Type] contains "text" } { STREAM::expression {@realserver@virtualserver@} STREAM::enable } }
I even used the STREAM_MATCHED event to ensure it executed, which it does.
The other attempt was using a rewrite profile (parent of rewrite-uri-translation) to have client "https://virtualserver/kcontent/" and server "https://realserver/kcontent". This works for the initial launch of the selected user manual (iframes & javascript), but subsequent links from the TOC (iframe) fail to generate content into the secondary iframe.
I want to avoid having to edit this profile every time the content creators add new user manuals to the site.
- Gilles_Archer_3
Nimbostratus
I spoke too early. I was only trying stream or rewrite separately. But putting them together seems to solve the issue (so far). I'll let the testers maul it for a while.
- eLeCtRoN_26738
Nimbostratus
"I spoke too early. I was only trying stream or rewrite separately. But putting them together seems to solve the issue (so far). I'll let the testers maul it for a while."How did you use stream and rewrite together ? Have you create a stream profile and give this the Virtual Server and did a stream rewrite iRule as well ?
stream iRule like this example ?
when HTTP_REQUEST {
THX Manu
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