Forum Discussion

dacrud_18985's avatar
dacrud_18985
Icon for Nimbostratus rankNimbostratus
Jun 24, 2008

preserve hostname

Hi all,

 

 

I need to preserve the hostname to a back end apache server so that when the request gets passed through, the apache server can still pick it up through a virtualhost name. Is there anyway to do this? Any help would be appreciated.

 

 

Thanks.
  • You can preserve the hostname when by passing it to a variable or a global variable.

     

     

    I think we will need more information, can you provide any code that you have developed so far?

     

     

    thanks,

     

    CB

     

     

  • Hi,

     

     

    I don't think you need more information. Basically I'm trying to get Apache to recognize the hostname as it is passed through, as "ServerName" directive so that it can pick it up as a virtualhost. I just need to figure out how to pass the hostname through.
  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    The hostname requested by the client should already be passed in the Host header, and LTM will not modify or remove it unless explcitly configured to do so.

    You can test what LTM sees with a simple iRule:

    when HTTP_REQUEST {  
        log local0. "HTTP Host requested by [IP::client_addr]: [HTTP::host]"  
      }

    It will produce a log line in the LTM/Local Traffic log that looks like this for each request:

    HTTP Host requested by 192.168.1.12: www.domain.com

    The hostname reflected there should be what Apache sees.

    HTH

    /deb
  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    The hostname reflected there should be what Apache sees.

     

     

    You can verify what actually is sent to Apache by examining a packet trace on the link between the LTM and the servers.

     

     

    /d