Forum Discussion

Ramzi_Rhahlia_1's avatar
Ramzi_Rhahlia_1
Icon for Nimbostratus rankNimbostratus
Oct 25, 2014
Solved

generic iRULE to only replace links which have .subdmain.com from http to https

Hi All,

 

I am newbie on iRule and F5 and still learning about it. I had an issue lately and want to get more ideas that could help.

 

Problem:

I have an iRULE to change any http to https using stream::expression {@http@https@}. But, when get a webservice response the link referencing 'http://schemas.xmlsoap.org/' is changed to https. And thats makes it an invalid link and raise an application exception as the application expects 'http://schemas.xmlsoap.org/' not https.

 

I've tried this but didn't work STREAM:EXPRESSION {@http://(.{1,9}.subdomain.com)@https://\1@} but it didn't work(my URL changed from http://client1.subdomain.com to https://\1) because it seams that stream expression doesn't accept backrefrence (to call back the string matched by the regexp in the parenthesis). I am trying to make a generic rule as we have couple of clients and don't want to make a rule of each client (the link to the application would be e.g client1.subdomain.com).

 

I've tried to only omit schemas.xmlsoap.org by using the following expression: STREAM:EXPRESSION {@http://(?!schemas.xmlsoap.org)@https@} but it didn't work neither and every thing have change to https even https://schemas.xmlsoap.org.

 

Any ideas and suggestion are appreciated.

 

  • May be can try this:

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

8 Replies

  • JG's avatar
    JG
    Icon for Cumulonimbus rankCumulonimbus

    STREAM supports only "basic regex" only. See LTM stream profile: Multiple replacements & regular expressions. I suspect that one of the reasons F5 does not want to give us anything better than that is that that could use too much memory, in the context of product-line control. Memory is cheap these days, but you just can't add more to an "appliance".

     

  • kunjan's avatar
    kunjan
    Icon for Nimbostratus rankNimbostratus

    May be can try this:

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

    • JG's avatar
      JG
      Icon for Cumulonimbus rankCumulonimbus
      I thought a string could be matched only once with STREAM.
    • andrew_05_16419's avatar
      andrew_05_16419
      Icon for Nimbostratus rankNimbostratus
      I seams a very good solution as I have more than one link to ignore. STREAM::expression {@http://@https://@ @http://site1@http://site1@ @http://site2@http://site2@} I am gonna give it a try later this week because I don't have access to the administration interface and the person in charge is on leave this week. It is unfortunate that there is no emulator for iRULE that we could use to test.
  • May be can try this:

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

    • JG's avatar
      JG
      Icon for Cumulonimbus rankCumulonimbus
      I thought a string could be matched only once with STREAM.
    • andrew_05_16419's avatar
      andrew_05_16419
      Icon for Nimbostratus rankNimbostratus
      I seams a very good solution as I have more than one link to ignore. STREAM::expression {@http://@https://@ @http://site1@http://site1@ @http://site2@http://site2@} I am gonna give it a try later this week because I don't have access to the administration interface and the person in charge is on leave this week. It is unfortunate that there is no emulator for iRULE that we could use to test.