Forum Discussion

Ben_Kennedy_502's avatar
Ben_Kennedy_502
Icon for Nimbostratus rankNimbostratus
Nov 02, 2009

rewriting links within content

Hello,

 

 

I have some webservers listening on non-standard ports, which when returning content, are adding links to the content of the page using these non-standard ports (i.e. a link will point to http://www.google.com:8880 ).

 

 

I have tried using the stream profile to rewrite content, but this doesn't seem to pick up links within the page, only text displayed on the page. Is there a way to rewrite the content to remove the port numbers in HTTP links returned to the client.

 

 

 

Thanks

2 Replies

  • Hi Ben,

    The stream profile should rewrite any uncompressed response content that matches. The problem with using a stream profile without an iRule is that the all request and response payloads are inspected and potentially modified. If you don't need to rewrite request payloads and don't want to waste resources enabling the stream filter on non-text responses, it would be most efficient to use a STREAM::expression iRule to configure the stream profile. You can check the wiki page (Click here) for details on using STREAM::expression.

    If the response content is compressed, you should ideally disable compression on the web servers. If that's not an option, you can remove the Accept-Encoding header using a custom HTTP profile with the "Header to remove" field set as "Accept-Encoding". Or you can add this to your stream iRule:

      
      when HTTP_REQUEST {  
          Prevent the server from sending a compressed response  
         HTTP::header remove Accept-Encoding  
      }  
      

    You might also want to double-check the stream filter find/replace strings if the iRule doesn't work.

    Aaron
  • Hi Aaron,

     

     

    Thanks for that, it seems to do the trick, I'm not sure why it isn't working with just the stream profile, but as you say, it'll be better to tidy it up in the irule anyway.

     

     

    Thanks,

     

    Ben