Forum Discussion

Robert_47833's avatar
Robert_47833
Icon for Altostratus rankAltostratus
Jun 15, 2011

what is the difference of HTTP::header replace and HTTP::redirect

Hi,can someone help me in these

 

1:what is the difference of HTTP::header replace and HTTP::redirect

 

2:how to replace one pattern in the HTTTP::header in the first occurrence?

 

3:Can i USE HTTP::uri in case I want to replace uri?

 

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    1. Replacing a header does just that, it replaces any header you specify. You could replace the host header or a custom header, or the Location header in a response, etc. The HTTP::redirect command issues a redirect to the client, causing them to initiate a new connection to the specified host & URI.

     

     

    2. You want to replace one entire header, or a specific pattern within that header? Either way you'd be using HTTP::replace, but the logic surrounding it would be different depending on what you want to do.

     

     

    3. Yes, HTTP::uri will get the information set in the URI if you don't specify any arguments, or set a new URI if you specify a value.

     

     

    Colin
  • HI,

     

    Thanks

     

    I want to replace the aaa appear in the first time of HTTP::head

     

    how to achieve this?

     

     

    You mean replace will not change the url in the browser?

     

     

    we also can use HTTP::uri to replace the pattern in URL?
  • Hi Jucao,

    Can you give more detail on what you're trying to do? Can you provide a sample HTTP request that the client makes and what you'd like it to be changed to?

    Here's an example of what would help:

    GET / HTTP/1.1
    User-Agent: curl/7.20.1 (i686-pc-cygwin) libcurl/7.20.1 OpenSSL/0.9.8r zlib/1.2.5 libidn/1.18 libssh2/1.2.5
    Host: www.google.com
    My-Custom-Header: aaa-bbb
    Accept: */*
    

    GET / HTTP/1.1
    User-Agent: curl/7.20.1 (i686-pc-cygwin) libcurl/7.20.1 OpenSSL/0.9.8r zlib/1.2.5 libidn/1.18 libssh2/1.2.5
    Host: www.google.com
    My-Custom-Header: bbb-bbb
    Accept: */*
    

    Aaron
  • GET / HTTP/1.1

     

    User-Agent: curl/7.20.1 (i686-pc-cygwin) libcurl/7.20.1 OpenSSL/0.9.8r zlib/1.2.5 libidn/1.18 libssh2/1.2.5

     

    Host: www.google.com

     

    My-Custom-Header: bbb-bbb

     

    Accept: */*

     

     

    1:I want to change the first lib in User-Agent to xxx,how can I make it?

     

    2:after replace,what is the url in client's browser?