I'm not sure what ns_conn location looks at, but it's not the hostname from the request.
Example: I have a server setup on a machine called test. When I make a request to 'http://test:8000', ns_conn location returns 'http://test:8000'. If I add an entry to the hosts file on my workstation that has the ip of test, but a different name (say 'test2'), and make a request to 'http://test2:8000', ns_conn location still returns 'http://test:8000'. The Host header from ns_conn headers is correct, however: 'test2:8000'. I will probably just use the value from the headers. As Bas pointed out, that's what virtual servers do, so why shouldn't I use it? :) It does seem strange that ns_conn location doesn't use the requested hostname, but then I'm not sure where it gets the hostname from. Thanks for the help. Ross On Wed, 2004-05-05 at 07:43, Vlad Seryakov wrote: > ns_conn location should give you the whole url including http:// or https:// > > Brady Wetherington wrote: > > I've run into similar problems where I had home-grown virtualhosting working > > with some DAV stuff I was working on. The only way I could figure out how to > > get the hostname was the same as yours. On the bright side, you could make a > > nice little routine that tries to look at ns_conn hostname (or whatever it > > is) and, only if it's blank, grab it from the headers. > > > > I fiddled around with simulating requests from Telnet, and I think I > > determined that the hostname was set only when you did something like: > > > > GET http://hostname/blah/blah HTTP/1.0 > > > > But modern HTTP/1.1 requests only set them in the headers: > > > > GET /blah/blah HTTP/1.1 > > Host: hostname > > > > I agree, I felt a little 'dirty' grabbing the hostname out of there myself. > > > > I should note as a caveat that I'm on an older version of aolserver than > > everyone else (3.4ish or so), and I haven't touched most of that code in a > > long time, so things might be different now. > > > > On Tue, 4 May 2004 14:11:53 -0600, Ross Simpson <[EMAIL PROTECTED]> wrote: > > > > > >>Hello, > >> > >>I'm working on a site that uses SSL, and want to redirect users who > >>access the site via http to https. > >> > >>The way I've done this in the past is to check ns_conn driver, then > >>redirect to a hardcoded URL. > >> > >>However, I would like to be able to do this independent of the system > >>aolserver is running on -- e.g., have it work in both development and > >>production environments. Since requests in production may be coming > > > >>from a load balancer, using the machine's hostname won't work. > > > >>I've looked through the information available in ns_info and ns_conn, > >>and the _only_ place I see the hostname that was actually in the > >>original request is the Host header, available from ns_conn headers. > >>I'd really rather not have to dip into the headers to get this. > >> > >>I'm sure other people have solved the problem.. how it this typically > >>done? > >> > >>Thanks for any ideas :) > >>Ross > >> > >> > >>-- > >>AOLserver - http://www.aolserver.com/ > >> > >>To Remove yourself from this list, simply send an email to > > > > <[EMAIL PROTECTED]> with the > > > >>body of "SIGNOFF AOLSERVER" in the email message. You can leave the > > > > Subject: field of your email blank. > > > > > > -- > > AOLserver - http://www.aolserver.com/ > > > > To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> > > with the > > body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field > > of your email blank. > > -- > Vlad Seryakov > 703 488-2173 office > [EMAIL PROTECTED] > http://www.crystalballinc.com/vlad/ > > > -- > AOLserver - http://www.aolserver.com/ > > To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with > the > body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field > of your email blank. -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of your email blank.
