Forum Discussion

Jon_S's avatar
Jon_S
Icon for Nimbostratus rankNimbostratus
May 14, 2014

ProxyPass STREAM replacement of hostnames

Using version 10.9 on LTM 11.5.1.

 

I've noticed that it's required to include a trailing "/" when doing hostname substitutions, e.g.

 

my.external.name/ := my.internal.name/

 

and I have seen that

 

my.external.name := my.internal.name

 

doesn't do anything.

 

My question is if there is any way to improve the script so that it could catch "pure host" links in the response, i.e. href of hostname only with no trailing /

 

2 Replies

  • I suppose you could, but then that doesn't actually exist. Browsers don't show it, but in the absence of a specified URI path, there will ALWAYS BE a forward slash / after the host name.

    Just to give you an example, try this iRule on an LTM VIP:

    when HTTP_REQUEST {
        log local0. [HTTP::uri]
    }
    

    When you test, don't include a URI in the browser, just the host name. The URI will be "/".

    And then try this from the BIG-IP shell:

    curl -v http://x.x.x.x
    

    where x.x.x.x is the IP address of any port 80 pool member. You're going to see something like this:

    GET / HTTP/1.1
    Date: some date
    Server: Apache...
    Host: x.x.x.x
    Accept: */*
    

    Notice that even curl plants a / in the request.

  • Jon_S's avatar
    Jon_S
    Icon for Nimbostratus rankNimbostratus

    Thanks Kevin.

     

    Good information, but I was particularly interested in the stream replacement in the RESPONSE, as embedded "Host" hyperlink are ignored.

     

    I have however, in the meantime, realised that good as the script is, it isn't actually the right tool for what I want to do, as I need to search/replace multiple items in the response.

     

    I have a number of internal site host-names I need to hide/replace and the sites redirect and link to each other in a number of places. The current script only has a single instance replacement so I think I need to either extend it to perform multiple replacements - or perhaps consider a different method.