Forum Discussion

Ben_D's avatar
Ben_D
Icon for Nimbostratus rankNimbostratus
Aug 18, 2023

How to change javascript content from server response

Hello, 

I've an issue one of our apps call an external services across F5 BIG-IP, response is an javascript download on client browser. 

I would like to modify the content ( change fqdn ) of this javascript : irule, iruleLX or LTM policy. 

Do you know how can i do this ? 

I try with stream but it seems not work. 

best regards

 

  • Can you share the irule/stream profile?

    Because with an irule it should work:

    when HTTP_REQUEST {
     # Disable the stream filter for client requests
       STREAM::disable
       HTTP::header remove Accept-Encoding
    }
    
    when HTTP_RESPONSE {
     # Disable the stream filter for server responses
     STREAM::disable
     # Enable the stream filter for text responses only
     if {([HTTP::status] == 200)} {
      # Replace 'example.com' with 'app.example.com'
      STREAM::expression {@example.com@app.example.com@}
      # Enable the stream filter
      STREAM::enable
     }
    }

    Cheers,
    Kees