Forum Discussion

Luis_Melendrez's avatar
Luis_Melendrez
Icon for Altostratus rankAltostratus
Sep 21, 2017

Rewrite response URL

We have build two Virtual Servers on LTM. When clients connect to first server the connection establishes successful and this server redirects the connection to secondary server with the internal URL which external clients don't know what this is. My secondary external server should look something like https://myexternalserver.mycomp.com/.

 

Is there a way to re-write server's response from

 

to https://myexternalserver.mycomp.com/etc/etc2/etc3

 

so my external clients can access this resource?

 

2 Replies

  • Hi Luis

    Could you add the following irule to your VS and check /var/log/ltm to see if its matching correctly...

    Also add a stream profile to your VS.

    when HTTP_REQUEST {
    
      Remove the "Accept-Encoding" header 
     HTTP::header remove "Accept-Encoding"
    
      Disable the stream filter for all requests 
     STREAM::disable 
    
    } 
    
    when HTTP_RESPONSE {
    
     Check if response type is text 
     if { [HTTP::header value Content-Type] contains "text" || [HTTP::header value Content-Type] contains "xml" } {
    
         Rewrite 
        STREAM::expression [list {@http:\@https:\@} {@internal-server-name:8008@myexternalserver.mycomp.com@}] 
    
         Enable the stream filter for this response only 
        STREAM::enable 
     } 
    
    }
    
    when STREAM_MATCHED {
       Log each match found by the stream filter
      log local0. "Stream filter matched: [STREAM::match]"
    }
    

    Please give us a feedback

    Regards