# F5 replace string from "http" to "https" in jar files

**URL:** <https://community.f5.com/t/f5-replace-string-from-http-to-https-in-jar-files/42734>\
**Category:** Technical Forums\
**Tags:** dev, irules, devops, application-delivery\
**Created:** [December 17, 2010, 3:41am UTC](https://community.f5.com/t/f5-replace-string-from-http-to-https-in-jar-files/42734 "2010-12-17T03:41:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![hector\_40668](https://avatars.discourse-cdn.com/v4/letter/h/e495f1/32.png) [@hector\_40668](https://community.f5.com/u/hector_40668)\
**Post date:** [December 17, 2010, 3:41am UTC](https://community.f5.com/t/f5-replace-string-from-http-to-https-in-jar-files/42734/1 "2010-12-17T03:41:59Z")

</div>

Hi,

I am very new to F5 and I hope you guys here can help me out on this.

Recently we encounter some problems with files that are going thru the F5. It seems like when the client downloads jars files thru the F5, the contents of the jars files seems to replace.

For example: original hector.jar files contains multiple files with the string “[http://example.com](http://example.com)”, when the client download this hector.jar files and view it on their local machine, “[http://example.com](http://example.com)” will be replace with “[https://example.com](https://example.com)”.

I am really very puzzled as in how come the contents of the jar files will be changed. Is there a settings in the F5 console to stop it from doing so?

Rgds

Hector

---

<div class="post-metadata">

**Author:** ![hoolio](https://avatars.discourse-cdn.com/v4/letter/h/f6c823/32.png) [@hoolio](https://community.f5.com/u/hoolio)\
**Post date:** [December 17, 2010, 10:37pm UTC](https://community.f5.com/t/f5-replace-string-from-http-to-https-in-jar-files/42734/2 "2010-12-17T22:37:43Z")

</div>

Hi Hector,

By default LTM won’t modify the response HTTP headers or payload. You could potentially enable this response content rewriting with a stream profile and/or iRule. But that wouldn’t be enabled by default. If you test directly to the server(s), do you see http:// or https:// links? Can you post an anonymized copy of the virtual server definition using ‘b virtual VS\_NAME list’?

Aaron

---

<div class="post-metadata">

**Author:** ![hector\_40668](https://avatars.discourse-cdn.com/v4/letter/h/e495f1/32.png) [@hector\_40668](https://community.f5.com/u/hector_40668)\
**Post date:** [December 19, 2010, 11:45pm UTC](https://community.f5.com/t/f5-replace-string-from-http-to-https-in-jar-files/42734/3 "2010-12-19T23:45:09Z")

</div>

Hi Aaron,

Downloading direct from the server does not changes anything and I could still see http:// links in my jar files.

The config is as follows:

virtual virtual\_server\_weblogic\_https {

snat automap

pool pool\_UAT\_7002

destination 192.xxx.xx.xx:https

ip protocol tcp

rules app\_uat

profiles

CA\_SSL

WebLogic\_Stream

Weblogic\_HTTPS

tcp

persist app\_cookies

}

Thanks for looking into this.

Rgds

Hector

---

<div class="post-metadata">

**Author:** ![Chris\_Miller](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/chris_miller/32/14702_2.png) [@Chris\_Miller](https://community.f5.com/u/Chris_Miller)\
**Post date:** [December 20, 2010, 2:25pm UTC](https://community.f5.com/t/f5-replace-string-from-http-to-https-in-jar-files/42734/4 "2010-12-20T14:25:55Z")

</div>

I’d check out that WebLogic\_Stream profile and Weblogic\_HTTPS profile.

---

<div class="post-metadata">

**Author:** ![hoolio](https://avatars.discourse-cdn.com/v4/letter/h/f6c823/32.png) [@hoolio](https://community.f5.com/u/hoolio)\
**Post date:** [December 20, 2010, 5:17pm UTC](https://community.f5.com/t/f5-replace-string-from-http-to-https-in-jar-files/42734/5 "2010-12-20T17:17:43Z")

</div>

As Chris suggested, it’s quite likely that the stream profile would be the reason for the change in the application content. You can use an iRule to selectively enable the content rewriting for the stream profile:

[http://devcentral.f5.com/wiki/default.aspx/iRules/stream\_\_expression](http://devcentral.f5.com/wiki/default.aspx/iRules/stream%5C_%5C_expression)

Aaron

---

<div class="post-metadata">

**Author:** ![hoolio](https://avatars.discourse-cdn.com/v4/letter/h/f6c823/32.png) [@hoolio](https://community.f5.com/u/hoolio)\
**Post date:** [December 22, 2010, 2:24am UTC](https://community.f5.com/t/f5-replace-string-from-http-to-https-in-jar-files/42734/6 "2010-12-22T02:24:20Z")

</div>

Yes, the stream profile configuration of a source of http:// and a target of https:// dictates that LTM will replace http:// with https:// in all request and response payloads. To avoid this issue, you can selectively enable the stream filter using STREAM::enable/disable in an iRule. The STREAM::expression wiki page has some examples. A safe bet would be to restrict the rewriting to responses only with a response content-type of text:

[http://devcentral.f5.com/wiki/default.aspx/iRules/stream\_\_expression](http://devcentral.f5.com/wiki/default.aspx/iRules/stream__expression)

```tcl
when HTTP_REQUEST {
    Disable the stream filter for all requests
   STREAM::disable
}
when HTTP_RESPONSE {

    Check if response type is text
   if {[HTTP::header value Content-Type] contains "text"}{

       Replace http:// with https://
      STREAM::expression "@http://@https://@"

       Enable the stream filter for this response only
      STREAM::enable
   }
}

```

Aaron
