Forum Discussion

Squeak's avatar
Icon for Cirrus rankCirrus
Dec 02, 2020

Rewrite shortname in response


I´ve a site behind an apm, "". The site have links that contains shortnames "asd" and I need to add the domain part to the shortname in the http response, like this "". I tried to write an irule but it looks like that the APM aren´t compatible with the stream profile.

Is it possible to fix this?

    when HTTP_REQUEST {
         #Disable the stream filter for requests
         #Remove this header to prevent server from compression response
        HTTP::header remove Accept-Encoding
    when HTTP_RESPONSE {
        set internal_host "asd" 
        set external_host ""
         #Rewrite the Location header for redirects 
        if { [HTTP::header exists Location] }{ 
            HTTP::header replace Location [string map "$internal_host $external_host" [HTTP::header Location]] 
         #Rewrite the response content using a stream profile if it is text 
        if { [HTTP::header Content-Type] contains "text" } { 
         #Set the stream expression with the find/replace strings 
            STREAM::expression "@$internal_host@$external_host@" 
         #Enable the stream filter 

1 Reply

  • Hi  ,


    I dont think its possible. APM with Stream profile. You can try this though - VS behind VS.

    Put your APM on VS1 and let that pass the traffic to another VS2, in VS2 you can apply your stream profile & do your required changes.


    Please test and update us if possible.