# Stream Profile is not working with javascript var?

**URL:** <https://community.f5.com/t/stream-profile-is-not-working-with-javascript-var/73690>\
**Category:** Technical Forums\
**Tags:** application-delivery\
**Created:** [December 18, 2023, 5:41pm UTC](https://community.f5.com/t/stream-profile-is-not-working-with-javascript-var/73690 "2023-12-18T17:41:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![logan92](https://avatars.discourse-cdn.com/v4/letter/l/ce7236/32.png) [@logan92](https://community.f5.com/u/logan92)\
**Post date:** [December 18, 2023, 5:41pm UTC](https://community.f5.com/t/stream-profile-is-not-working-with-javascript-var/73690/1 "2023-12-18T17:41:03Z")

</div>

Hi, i want to solve mixed content issue but stream profile is not working with this javascript code , i want to change&nbsp;http:\u002f\u002 to https:// so i created an irule that matches&nbsp;@@http\u002f\u002f@https://@ , but when i saw response on webpage (view page source) , the url is still the same as http\u002f\u002f

```javascript
<script type="text/javascript">
var _fV4UI=true;var _spPageContextInfo = {webServerRelativeUrl: "\u002f", webAbsoluteUrl: "http:\u002f\u002fworkpoint.com", siteAbsoluteUrl: "http:\u002f\u002fworkpoint.com", serverRequestPath: "\u002f_layouts\u002f15\u002fFormServer.aspx", layoutsUrl: "_layouts\u002f15", webTitle: "My Process", webTemplate: "1", tenantAppVersion: "0", isAppWeb: false, Has2019Era: true, webLogoUrl: "\u002fPortalImages\u002fLogo-W.jpg", webLanguage: 1033, currentLanguage: 1033, currentUICultureName: "en-US", currentCultureName: "en-GB", clientServerTimeDelta: new Date("2023-12-14T11:41:57.2492077Z") - new Date(), updateFormDigestPageLoaded: new Date("2023-12-14T11:41:57.2492077Z"), siteClientTag: "9$$16.0.5173.1000", crossDomainPhotosEnabled:false, webUIVersion:15, webPermMasks:{High:176,Low:138612807}, pagePersonalizationScope:1,userId:401,userLoginName:"", systemUserKey:"S-1-5-21-842925246-606747145-682003330-8418", alertsEnabled:true, siteServerRelativeUrl: "\u002f", allowSilverlightPrompt:'True', isSiteAdmin: false};Flighting.ExpFeatures = [480215056,1880287568,1561350208,302071836,3212816,69472768,4194310,-2113396707,268502022,-872284160,1049232,-2147421952,65536,65536,2097472,917504,-2147474174,1372324107,67108882,0,0,-2147483648,2097152,0,0,32768,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32768];//]]>
</script>

```

```tcl
when HTTP_REQUEST {
# Disable the stream filter for all requests
STREAM::disable
}
when HTTP_RESPONSE {
# Check if response type is text, javascript, svg, or other images
# if {[HTTP::header value Content-Type] contains "text" || [HTTP::header value Content-Type] contains "text/javascript" || [HTTP::header value Content-Type] contains "svg" || [HTTP::header value Content-Type] contains "jpeg" || [HTTP::header value Content-Type] contains "png" || [HTTP::header value Content-Type] contains "gif"} {
# Replace http:// with https://
STREAM::expression {@http://@https://@ , @http%3a%2f%2f@https://@ , @http\u002f\u002f@https://@}
# Enable the stream filter for this response only
STREAM::enable
# }
}

```

How can i solve the stream profile issue?&nbsp;  
Is CSP header can help with mixed content issue when it inserted by F5 in reponse to the client or should i change content for any http to https by using stream profile?  
do i need custom&nbsp;HTTP&nbsp; rewrite profile&nbsp;profile to rewrite redirects from http to https?

---

<div class="post-metadata">

**Author:** ![zamroni777](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/zamroni777/32/1473_2.png) [@zamroni777](https://community.f5.com/u/zamroni777)\
**Post date:** [December 19, 2023, 2:13am UTC](https://community.f5.com/t/stream-profile-is-not-working-with-javascript-var/73690/2 "2023-12-19T02:13:10Z")

</div>

stream profile uses regular expression syntax which “:” , “.”, “\” are part of the syntax

> **[Regular expression | POSIX basic and extended](https://en.wikipedia.org/wiki/Regular_expression#POSIX_basic_and_extended)**
>
> In the POSIX standard, Basic Regular Syntax (BRE) requires that the metacharacters ( ) and { } be designated \\(\\) and \\{\\}, whereas Extended Regular Syntax (ERE) does not.

therefore, you need to instead use \x3A, \x2E, \x5C.  
for other hexa codes, you can refer to

> **[ascii(7) - Linux manual page](https://man7.org/linux/man-pages/man7/ascii.7.html)**

---

<div class="post-metadata">

**Author:** ![Juergen\_Mang](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/juergen_mang/32/12756_2.png) [@Juergen\_Mang](https://community.f5.com/u/Juergen_Mang)\
**Post date:** [December 19, 2023, 10:26am UTC](https://community.f5.com/t/stream-profile-is-not-working-with-javascript-var/73690/3 "2023-12-19T10:26:21Z")

</div>

Your stream expression is invalid, it takes a tcl list, not a comma separated one.

This is documented here: [STREAM::expression](https://clouddocs.f5.com/api/irules/STREAM__expression.html)

---

<div class="post-metadata">

**Author:** ![logan92](https://avatars.discourse-cdn.com/v4/letter/l/ce7236/32.png) [@logan92](https://community.f5.com/u/logan92)\
**Post date:** [December 19, 2023, 10:30am UTC](https://community.f5.com/t/stream-profile-is-not-working-with-javascript-var/73690/4 "2023-12-19T10:30:16Z")

</div>

Thanks , now it works.
