Forum Discussion

logan92's avatar
Icon for Altocumulus rankAltocumulus
Dec 14, 2023

how to match hostname,uri & subdomain within stream profile


I want to rewrite http contents in webpage based on certain subdomain , i want only to apply stream profile on this subdomain , the website has many domains like ,  , i want to convert some links in webpage from http to https. i've used this solution , it works but it gives us errors in other webpages (other subdomains that exist on same website domain).



   # Disable the stream filter for all requests
   # LTM does not decompress response content, so if the server has compression enabled
   # and it cannot be disabled on the server, we can prevent the server from
   # sending a compressed response by removing the compression offerings from the client
   HTTP::header remove "Accept-Encoding"
   # 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



How can i match just for certain subdomain or host or uri in stream profile, as i know i need to change response contents from http to https but http response doesn't have URI.

i just need to apply this stream profile for just 1 subdomain exist on this https virtual server.


7 Replies

  • You can modify the REGEX experssion. Currently:

     STREAM::expression {@http://@https://@}

    So, if you want to match only on FQDN, this would be as follows:

     STREAM::expression {@}

    Hope this helps? If not, please give examples of the transformation you are looking to accomplish. Initial URI and post URI.

    • logan92's avatar
      Icon for Altocumulus rankAltocumulus

      Hi, Thank you for the answer , but i want to natch on HTTP_REQUEST URI or hostname or path.

    • zamroni777's avatar
      Icon for Nacreous rankNacreous

      as whisperer said that stream directive is regex, so:
       ":" and "." are part of regex syntaxes, so i suggest replace them with \x3A and \x2A
      reference for the hexadecimal codes:

      To disable server side compression, simply apply HTTP compression profile to the virtual server.
      this enables the compression offload which ltm requests uncompressed response from server (i.e. no Accept-Encoding header in server bound request).


  • Hello there,

    First, you use the stream processing language, then you define the matching criteria for each element. Make sure to use precise syntax to accurately capture the desired patterns. You should regularly test your expression in specific cases.

    I hope this is informative for you.