RE: Virtual Hosts and useCanonical
Thanks Bill. I suppose I must have been dreaming about getServerName working. Our current production box is TC4.1.30, and for our next version of the app, I wanted to target TC5.0.29. Looks like it is a must have. Yoav will be happy. ;) -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Bill Barker Sent: Thursday, October 28, 2004 12:21 AM To: [EMAIL PROTECTED] Subject: Re: Virtual Hosts and useCanonical request.getServerName() is the value of the Host header. You want request.getLocalName(). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Virtual Hosts and useCanonical
There is a setting somewhere in Tomcat (versions up to 4.1.X at least) where you enable/disable reverse DNS. Most of the time you want this off, but I think in your case you may need it turned on. I think the swtich is in the Tomcat server.xml, and it relates to the connector you are using. Its something like 'enableLookups'. While this sounds odd, two books I have state you need this to get names and not IP addresses. Also, the books mention using request.getRemoteHost(), and that it is effected by the settings in server.xml Hope it helps, Al G - Original Message - From: Mike Curwen [EMAIL PROTECTED] Date: Wednesday, October 27, 2004 4:36 pm Subject: Virtual Hosts and useCanonical Yup, I've asked about/commented about this before. I'm having trouble with Vhosts, server names, and how to get the value I want out of request.getServerName(), and this is all with apache/jk/tomcat. (apache is in the 2's somewhere, jk (not jk2) and tomcat 4.1.30 and 5.0.29). I'm only get the canonical name, help me get the alias http://marc.theaimsgroup.com/?l=tomcat-userm=108315928213678w=2 I don't care about alias, get me canonical. http://marc.theaimsgroup.com/?l=tomcat-userm=106095508818371w=2 So I know that both of these seem to have worked (or been doing a good imitation of it). But now, for the life of me, I can't get request.getServerName() to return the canonical ServerName from httpd.conf. apache's httpd.conf -- VirtualHost 139.142.220.45:80 UseCanonicalName On ServerName devstar.myhost.com ServerAlias www.devstar.myhost.com DocumentRoot /home/data3/me20 Location /WEB-INF/ AllowOverride None deny from all /Location JkMount /*.jsp tomcat1 JkMount /login tomcat1 ErrorLog /var/log/test/error_log CustomLog /var/log/test/access_log common /VirtualHost tomcat1's server.xml -- Host name=devstar.myhost.com debug=0 Aliaswww.devstar.myhost.com Context path= docBase=/home/data3/myhost/ etc... When I type in http://www.devstar.myhost.com , I was hoping that request.getServerName() would give me devstar.myhost.com (without the www). But it doesn't. It (jk? tomcat?) doesn't seem to honour the useCanonicaldirective. There seems to be some controversy about this?http://www.mail-archive.com/tomcat- [EMAIL PROTECTED]/msg32367.html Have I been going slowly crazy, and this has never worked the way I thought it did? mike curwen intermediate programmer globally boundless 204 885-7733 ext 227 www.globallyboundless.com --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Virtual Hosts and useCanonical
Those books are making reference to getting the client's IP/hostname. And that would be controlled through the connector attribute 'enableLookups'. This is about getting the Server's hostname. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 27, 2004 4:48 PM To: Tomcat Users List Subject: Re: Virtual Hosts and useCanonical There is a setting somewhere in Tomcat (versions up to 4.1.X at least) where you enable/disable reverse DNS. Most of the time you want this off, but I think in your case you may need it turned on. I think the swtich is in the Tomcat server.xml, and it relates to the connector you are using. Its something like 'enableLookups'. While this sounds odd, two books I have state you need this to get names and not IP addresses. Also, the books mention using request.getRemoteHost(), and that it is effected by the settings in server.xml Hope it helps, Al G - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Virtual Hosts and useCanonical
request.getServerName() is the value of the Host header. You want request.getLocalName(). Mike Curwen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Yup, I've asked about/commented about this before. I'm having trouble with Vhosts, server names, and how to get the value I want out of request.getServerName(), and this is all with apache/jk/tomcat. (apache is in the 2's somewhere, jk (not jk2) and tomcat 4.1.30 and 5.0.29). I'm only get the canonical name, help me get the alias http://marc.theaimsgroup.com/?l=tomcat-userm=108315928213678w=2 I don't care about alias, get me canonical. http://marc.theaimsgroup.com/?l=tomcat-userm=106095508818371w=2 So I know that both of these seem to have worked (or been doing a good imitation of it). But now, for the life of me, I can't get request.getServerName() to return the canonical ServerName from httpd.conf. apache's httpd.conf -- VirtualHost 139.142.220.45:80 UseCanonicalName On ServerName devstar.myhost.com ServerAlias www.devstar.myhost.com DocumentRoot /home/data3/me20 Location /WEB-INF/ AllowOverride None deny from all /Location JkMount /*.jsp tomcat1 JkMount /login tomcat1 ErrorLog /var/log/test/error_log CustomLog /var/log/test/access_log common /VirtualHost tomcat1's server.xml -- Host name=devstar.myhost.com debug=0 Aliaswww.devstar.myhost.com/Alias Context path= docBase=/home/data3/myhost/ etc... When I type in http://www.devstar.myhost.com , I was hoping that request.getServerName() would give me devstar.myhost.com (without the www). But it doesn't. It (jk? tomcat?) doesn't seem to honour the useCanonical directive. There seems to be some controversy about this? http://www.mail-archive.com/[EMAIL PROTECTED]/msg32367.html Have I been going slowly crazy, and this has never worked the way I thought it did? mike curwen intermediate programmer globally boundless 204 885-7733 ext 227 www.globallyboundless.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]