Previous Next

Thread: Bad request(invald hostname)

Last post 01-28-2007 10:46 PM by qbernard. 5 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (6 items)

Sort Posts:

  • 01-23-2007, 5:07 AM

    Bad request(invald hostname)

    I have the following configuration:
    behind the ADSL router there is a LAN with the workstations and a Linux box with Apache and DNS server. It has 2 network adapters, eth0(link with LAN, ip range 192.168.1.1-253) and eth1(link with W2k3, ip 192.168.10.1). The W2k3 box(running IIS 6.0) is connected directly to the Linux boxand has the 192.168.10.2 ip associated.

    What I need to do: I need to host sites both on Apache and IIS.

    What have I done to accomplish this: I have created some virtual hosts on Apache for sites hosted on it and they are working just fine. In order to access sites on IIS I have created some virtual hosts with proxy pass. On the W2k3 box, the sites are created using host header values. I have edited the c:\windows\system32\drivers\etc\hosts file and added the sites on the IIS, so my hosts file on the W2k3 looks like that:

    127.0.0.1 localhost
    192.168.10.2 mydomain1.com
    192.168.10.2 mydomain2.com

    these lines are also added on the linux box hosts file

    Problem: when I try to access sites on the IIS from the outside, I get the Bad Request(Invalid hostname) error. If the default IIS site is up and running, when I try to access any of mydomain1.com or mydomain2.com, i get the IIS' default page. If I'm trying to access the sites from the browser on the W2k3 box or from the linux box, it works just fine.


    Question: what the problem might be and what would be the resolution?

    Thank you in advance

  • 01-24-2007, 10:42 PM In reply to

    Re: Bad request(invald hostname)

    Post the output of iisweb /query here. I think host header wasn't configure properly.
    Cheers,
    Bernard Cheah
  • 01-25-2007, 3:14 PM In reply to

    Re: Bad request(invald hostname)

    Thank you very much for reply! 

    problem solved

    virtual host in apache was not defined correctly

    here is the right entry in apache's httpd.conf

    <VirtualHost 192.168.1.1:80>
        ServerName mydomain1.com
        ProxyPreserveHost On
        ProxyRequests Off
        ProxyPass / http://192.168.10.2
        ProxyPassReverse / http://192.168.10.2
    </VirtualHost>

     

    and the lines present in hosts file are useless, they do not have any influence when the sites are accessed from the internet. Thank you

  • 01-25-2007, 10:37 PM In reply to

    Re: Bad request(invald hostname)

    Apache ? LOL....

    Cheers,
    Bernard Cheah
  • 01-26-2007, 2:28 AM In reply to

    Re: Bad request(invald hostname)

    yes...apache...i was trying to host sites both on iis and apache, on different machines

     

    apache was used also as a web server and a proxy for iis and i wasn't able to make it work with mod_proxy

     

    but i did not know where the problem was...in apache or iis

     

    at the begining i thought the iis was sending "bad answers"...but it turned out that apache was not "asking right questions"...

     

    thanks a lot!

     

    and sorry for the crossposting...i didn't where to put it first...and I didn't know it takes so much to be accepted(I thought the first post has been rejected). 

  • 01-28-2007, 10:46 PM In reply to

    Re: Bad request(invald hostname)

    No problem and thanks for sharing.
    Cheers,
    Bernard Cheah
Page 1 of 1 (6 items)
Page view counter