Forum Discussion

Fereda_187281's avatar
Fereda_187281
Icon for Nimbostratus rankNimbostratus
Oct 27, 2015
Solved

URI Translation and redirect help

Hello all;

 

I am using the BigIP v 11.6.

 

My users will in the browser put (https://abc-abc.abc.com/abc/example.asp=1) my redirect states redirect to "https://backendserver/xyc/example.asp=1" so in the Users window they are now seeing this link.

 

my question is can I make it so the user does NOT see that redirect link and they only see

 

"https://abc-abc.abc.com/abc/example.asp=1" and 1 is variable value in client and server side.

 

Thank you for any answers..

 

  • In that case you don't want to be doing a redirect you are wanting to rewrite the host, uri, and links. You can use proxypass for this, https://devcentral.f5.com/codeshare/proxypass-v10-v11 or your own iRule that could look something like this.

    when HTTP_REQUEST {
        if {[string tolower [HTTP::host]] equals "abc-abc.abc.com"}{
            HTTP::host "backendhostheader"
        }
        HTTP::uri [string map {/abc/ /xyc/} [HTTP::uri]]
    
        Disable the stream filter for all requests
       STREAM::disable
    
        LTM does not uncompress response content, so if the server has compression enabled
        and it cannot be disabled on the server, we can prevent the server from 
        sending a compressed response by removing the compression offerings from the client
       HTTP::header remove "Accept-Encoding"
    }
    when HTTP_RESPONSE {
           Replace http:// with https://
          STREAM::expression {@backendserver@abc-abc.abc.com@ @/xyc/@/abc/@}
    
           Enable the stream filter for this response only
          STREAM::enable
       }
    }
    

14 Replies

  • A standard http to https redirect on your HTTP VS should do what you want using this irule:

     

    when HTTP_REQUEST { HTTP::respond 301 noserver Location "https://[HTTP::host][HTTP::uri]" }

     

    • Fereda_187281's avatar
      Fereda_187281
      Icon for Nimbostratus rankNimbostratus
      Hi Brad ; sorry for my mistake .I fix my question. Thanks for your answer.
  • A standard http to https redirect on your HTTP VS should do what you want using this irule:

     

    when HTTP_REQUEST { HTTP::respond 301 noserver Location "https://[HTTP::host][HTTP::uri]" }

     

    • Fereda_187281's avatar
      Fereda_187281
      Icon for Nimbostratus rankNimbostratus
      Hi Brad ; sorry for my mistake .I fix my question. Thanks for your answer.
  • In that case you don't want to be doing a redirect you are wanting to rewrite the host, uri, and links. You can use proxypass for this, https://devcentral.f5.com/codeshare/proxypass-v10-v11 or your own iRule that could look something like this.

    when HTTP_REQUEST {
        if {[string tolower [HTTP::host]] equals "abc-abc.abc.com"}{
            HTTP::host "backendhostheader"
        }
        HTTP::uri [string map {/abc/ /xyc/} [HTTP::uri]]
    
        Disable the stream filter for all requests
       STREAM::disable
    
        LTM does not uncompress response content, so if the server has compression enabled
        and it cannot be disabled on the server, we can prevent the server from 
        sending a compressed response by removing the compression offerings from the client
       HTTP::header remove "Accept-Encoding"
    }
    when HTTP_RESPONSE {
           Replace http:// with https://
          STREAM::expression {@backendserver@abc-abc.abc.com@ @/xyc/@/abc/@}
    
           Enable the stream filter for this response only
          STREAM::enable
       }
    }
    
    • Fereda_187281's avatar
      Fereda_187281
      Icon for Nimbostratus rankNimbostratus
      Brad remarkeble!! It is working.But My Vip settings had not got stream check.it was selected none before so i was put the line which starts stream. Is it correct way?I think in this case te response uri include backend server hostname. So how can i hide the response? Thanks again..
    • Brad_Parker_139's avatar
      Brad_Parker_139
      Icon for Nacreous rankNacreous
      Yes, just add the default stream profile to your VIP and un-comment the STREAM commands in response to have the response re-written to mask the backend hostname and uri.
    • Fereda_187281's avatar
      Fereda_187281
      Icon for Nimbostratus rankNimbostratus
      Hİ Brad Again; Thank you for your help it is good working:) And ask one thing WHy we are disable stream all via irule although bind it in properties menu. Whats the stream action in here?
  • In that case you don't want to be doing a redirect you are wanting to rewrite the host, uri, and links. You can use proxypass for this, https://devcentral.f5.com/codeshare/proxypass-v10-v11 or your own iRule that could look something like this.

    when HTTP_REQUEST {
        if {[string tolower [HTTP::host]] equals "abc-abc.abc.com"}{
            HTTP::host "backendhostheader"
        }
        HTTP::uri [string map {/abc/ /xyc/} [HTTP::uri]]
    
        Disable the stream filter for all requests
       STREAM::disable
    
        LTM does not uncompress response content, so if the server has compression enabled
        and it cannot be disabled on the server, we can prevent the server from 
        sending a compressed response by removing the compression offerings from the client
       HTTP::header remove "Accept-Encoding"
    }
    when HTTP_RESPONSE {
           Replace http:// with https://
          STREAM::expression {@backendserver@abc-abc.abc.com@ @/xyc/@/abc/@}
    
           Enable the stream filter for this response only
          STREAM::enable
       }
    }
    
    • Fereda_187281's avatar
      Fereda_187281
      Icon for Nimbostratus rankNimbostratus
      Brad remarkeble!! It is working.But My Vip settings had not got stream check.it was selected none before so i was put the line which starts stream. Is it correct way?I think in this case te response uri include backend server hostname. So how can i hide the response? Thanks again..
    • Brad_Parker's avatar
      Brad_Parker
      Icon for Cirrus rankCirrus
      Yes, just add the default stream profile to your VIP and un-comment the STREAM commands in response to have the response re-written to mask the backend hostname and uri.
    • Fereda_187281's avatar
      Fereda_187281
      Icon for Nimbostratus rankNimbostratus
      Hİ Brad Again; Thank you for your help it is good working:) And ask one thing WHy we are disable stream all via irule although bind it in properties menu. Whats the stream action in here?