Re: apache/tomcat/modjk URL path question
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Rainer, On 10/22/2009 7:45 PM, Rainer Jung wrote: > On 22.10.2009 22:53, 1world1love wrote: >> Interestingly, if I access the page via IP:8080 (bypassing the rewrite), the >> auth works fine. No errors. > > H Perhaps the OP is using multiple elements with more than one instance of the webapp... one of them is correctly configured to use LDAP while the other one is not. This sounds like a different question than the original. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkrlxEgACgkQ9CaO5/Lv0PBujwCeKAe59Bk63OZw1UIEeAN8jrhp wSwAoLR1guL0/+VnB+zQzxx5fnVqa9go =krgT -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: apache/tomcat/modjk URL path question
On 22.10.2009 22:53, 1world1love wrote: > > > Rainer Jung-3 wrote: >> >> Sorry I didn't read all of it very carefully, but is it possible you >> left out the "PT" flag (pass-through)? Without it, Apache doesn't run a >> request which was changed by mod_rewrite through mod_jk. > > I just added it in right before your post, and it did actually do the > redirect correctly. So the request: > > http://mysite.com/path/MyApp/MyApp.html loads > http://mysite.com/MyApp/MyApp.html. > > Now, however, my authentication doesn't work. I have this app setup for form > based auth. My form page loads fine, but when I submit, I get this > immediately: > > The connection was reset > > In my mod_jk log, I can see that tomcat was trying to return a 408 status > page. In my app logs, I can see that the auth connection (ldap) is getting > reset and I get this in the log: > > WARNING: Exception performing authentication > javax.naming.CommunicationException [Root exception is > java.net.SocketException: Connection reset]; remaining name.. So I would do some network sniffing to check, which address and port the ldap auth tries to reach. Once you know that, you might find the reason. > Interestingly, if I access the page via IP:8080 (bypassing the rewrite), the > auth works fine. No errors. H - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: apache/tomcat/modjk URL path question
Rainer Jung-3 wrote: > > Sorry I didn't read all of it very carefully, but is it possible you > left out the "PT" flag (pass-through)? Without it, Apache doesn't run a > request which was changed by mod_rewrite through mod_jk. I just added it in right before your post, and it did actually do the redirect correctly. So the request: http://mysite.com/path/MyApp/MyApp.html loads http://mysite.com/MyApp/MyApp.html. Now, however, my authentication doesn't work. I have this app setup for form based auth. My form page loads fine, but when I submit, I get this immediately: The connection was reset In my mod_jk log, I can see that tomcat was trying to return a 408 status page. In my app logs, I can see that the auth connection (ldap) is getting reset and I get this in the log: WARNING: Exception performing authentication javax.naming.CommunicationException [Root exception is java.net.SocketException: Connection reset]; remaining name.. Interestingly, if I access the page via IP:8080 (bypassing the rewrite), the auth works fine. No errors. -- View this message in context: http://www.nabble.com/apache-tomcat-modjk-URL-path-question-tp25976682p26017011.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: apache/tomcat/modjk URL path question
On 22.10.2009 20:31, 1world1love wrote: > > Thanks Rainer, that was very helpful and exactly what I was looking for, > although I am still having issues getting it working. For anyone who may > know, or have done this sort of thing. When I add in a rewrite, I get the > following in my rewrite log: > > -applying pattern '^/path/(.*)' to uri '/path/MyApp/MyApp.html' > -rewrite '/path/MyApp/MyApp.html' -> '/MyApp/MyApp.html' > -local path result: /MyApp/MyApp.html > -prefixed with document_root to /htdocs/MyApp/MyApp.html > -go-ahead with /htdocs/MyApp/MyApp.html [OK] > > And of course the document_root does not apply because apache maps the path > /Admin to tomcat via mod_jk and so I get a 404. > > When I do a rewrite with the following: > > RewriteRule ^/path/(.*) https://%{HTTP_HOST}/$1 [L] > > It does the rewrite and of course redirects to that URL, but that pushes it > back through the load balancer which, in turn, pushes it to serverA because > it doesn't see the /path part of the URL. Sorry I didn't read all of it very carefully, but is it possible you left out the "PT" flag (pass-through)? Without it, Apache doesn't run a request which was changed by mod_rewrite through mod_jk. If it still doesn't work, you can set your JkLogLevel to debug and ru one of the requests that do not work and check in the log file, what URL mod_jk received to forward. Maybe you have to fix your JkMount. If it is not about mod_jk but mod_proxy, then set you LogLevel of Apache to debug, which also adds a reasonable amount of information about proxy processing. Regards, Rainer > Rainer Jung-3 wrote: >> >> On 20.10.2009 16:59, 1world1love wrote: >>> I know that there is probably an easy solution to this, but all the posts >>> I >>> have found relating to this don't seem to match my scenario, and most of >>> them I frankly don't get. >>> >>> My issue is this: I have a server running apache and tomcat. The server >>> is >>> behind a load balancer and firewall that manages mapping url paths to >>> specific servers. So we have a URL: http://example.com and based on the >>> path >>> it will do this: >>> >>> http://example.com -> serverA (/app/htdocs) >>> http://example.com/path -> serverB (/app/htdocs/path) >>> >>> I have an app in tomcat that I have mounted via JK. If I go to >>> http://myipaddress:8080/MyApp (by using the ip address I can bypass the >>> load >>> balancer) than my app loads. If I do http://myipaddress/MyApp my app >>> loads >>> (again bypassing the LB, but using the modjk). >>> >>> But if I do http://example.com/MyApp than obviously this won't work since >>> the LB will point to serverA. What seems to be at issue is that our >>> configuration requires that our http root be htdocs and that there be a >>> sub >>> called 'path' so that although there is a root '/' all of our content is >>> essentially served from '/path/' since the '/ ' URL will always go to >>> serverA. >>> >>> So I have adjusted my modjk mount to handle requests that look like: >>> http://example.com/path/MyApp, but when tomcat tries to handle this, >>> obviously it can't find anything at /path/MyApp. It expects /MyApp. >>> >>> I tried setting a context with path="/path/MyApp" docBase="MyApp", but >>> that >>> didn't work. I still get a 404. >>> >>> So, how can I specify that tomcat should expect '/path' in the URL for >>> all >>> potential apps? >> >> Probably >> >> http://tomcat.apache.org/connectors-doc/generic_howto/proxy.html >> >> should contain answers. >> >> Regards, >> >> Rainer - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: apache/tomcat/modjk URL path question
Thanks Rainer, that was very helpful and exactly what I was looking for, although I am still having issues getting it working. For anyone who may know, or have done this sort of thing. When I add in a rewrite, I get the following in my rewrite log: -applying pattern '^/path/(.*)' to uri '/path/MyApp/MyApp.html' -rewrite '/path/MyApp/MyApp.html' -> '/MyApp/MyApp.html' -local path result: /MyApp/MyApp.html -prefixed with document_root to /htdocs/MyApp/MyApp.html -go-ahead with /htdocs/MyApp/MyApp.html [OK] And of course the document_root does not apply because apache maps the path /Admin to tomcat via mod_jk and so I get a 404. When I do a rewrite with the following: RewriteRule ^/path/(.*) https://%{HTTP_HOST}/$1 [L] It does the rewrite and of course redirects to that URL, but that pushes it back through the load balancer which, in turn, pushes it to serverA because it doesn't see the /path part of the URL. Any ideas? Rainer Jung-3 wrote: > > On 20.10.2009 16:59, 1world1love wrote: >> I know that there is probably an easy solution to this, but all the posts >> I >> have found relating to this don't seem to match my scenario, and most of >> them I frankly don't get. >> >> My issue is this: I have a server running apache and tomcat. The server >> is >> behind a load balancer and firewall that manages mapping url paths to >> specific servers. So we have a URL: http://example.com and based on the >> path >> it will do this: >> >> http://example.com -> serverA (/app/htdocs) >> http://example.com/path -> serverB (/app/htdocs/path) >> >> I have an app in tomcat that I have mounted via JK. If I go to >> http://myipaddress:8080/MyApp (by using the ip address I can bypass the >> load >> balancer) than my app loads. If I do http://myipaddress/MyApp my app >> loads >> (again bypassing the LB, but using the modjk). >> >> But if I do http://example.com/MyApp than obviously this won't work since >> the LB will point to serverA. What seems to be at issue is that our >> configuration requires that our http root be htdocs and that there be a >> sub >> called 'path' so that although there is a root '/' all of our content is >> essentially served from '/path/' since the '/ ' URL will always go to >> serverA. >> >> So I have adjusted my modjk mount to handle requests that look like: >> http://example.com/path/MyApp, but when tomcat tries to handle this, >> obviously it can't find anything at /path/MyApp. It expects /MyApp. >> >> I tried setting a context with path="/path/MyApp" docBase="MyApp", but >> that >> didn't work. I still get a 404. >> >> So, how can I specify that tomcat should expect '/path' in the URL for >> all >> potential apps? > > Probably > > http://tomcat.apache.org/connectors-doc/generic_howto/proxy.html > > should contain answers. > > Regards, > > Rainer > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > > > -- View this message in context: http://www.nabble.com/apache-tomcat-modjk-URL-path-question-tp25976682p26015020.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: apache/tomcat/modjk URL path question
On 20.10.2009 16:59, 1world1love wrote: > I know that there is probably an easy solution to this, but all the posts I > have found relating to this don't seem to match my scenario, and most of > them I frankly don't get. > > My issue is this: I have a server running apache and tomcat. The server is > behind a load balancer and firewall that manages mapping url paths to > specific servers. So we have a URL: http://example.com and based on the path > it will do this: > > http://example.com -> serverA (/app/htdocs) > http://example.com/path -> serverB (/app/htdocs/path) > > I have an app in tomcat that I have mounted via JK. If I go to > http://myipaddress:8080/MyApp (by using the ip address I can bypass the load > balancer) than my app loads. If I do http://myipaddress/MyApp my app loads > (again bypassing the LB, but using the modjk). > > But if I do http://example.com/MyApp than obviously this won't work since > the LB will point to serverA. What seems to be at issue is that our > configuration requires that our http root be htdocs and that there be a sub > called 'path' so that although there is a root '/' all of our content is > essentially served from '/path/' since the '/ ' URL will always go to > serverA. > > So I have adjusted my modjk mount to handle requests that look like: > http://example.com/path/MyApp, but when tomcat tries to handle this, > obviously it can't find anything at /path/MyApp. It expects /MyApp. > > I tried setting a context with path="/path/MyApp" docBase="MyApp", but that > didn't work. I still get a 404. > > So, how can I specify that tomcat should expect '/path' in the URL for all > potential apps? Probably http://tomcat.apache.org/connectors-doc/generic_howto/proxy.html should contain answers. Regards, Rainer - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
apache/tomcat/modjk URL path question
I know that there is probably an easy solution to this, but all the posts I have found relating to this don't seem to match my scenario, and most of them I frankly don't get. My issue is this: I have a server running apache and tomcat. The server is behind a load balancer and firewall that manages mapping url paths to specific servers. So we have a URL: http://example.com and based on the path it will do this: http://example.com -> serverA (/app/htdocs) http://example.com/path -> serverB (/app/htdocs/path) I have an app in tomcat that I have mounted via JK. If I go to http://myipaddress:8080/MyApp (by using the ip address I can bypass the load balancer) than my app loads. If I do http://myipaddress/MyApp my app loads (again bypassing the LB, but using the modjk). But if I do http://example.com/MyApp than obviously this won't work since the LB will point to serverA. What seems to be at issue is that our configuration requires that our http root be htdocs and that there be a sub called 'path' so that although there is a root '/' all of our content is essentially served from '/path/' since the '/ ' URL will always go to serverA. So I have adjusted my modjk mount to handle requests that look like: http://example.com/path/MyApp, but when tomcat tries to handle this, obviously it can't find anything at /path/MyApp. It expects /MyApp. I tried setting a context with path="/path/MyApp" docBase="MyApp", but that didn't work. I still get a 404. So, how can I specify that tomcat should expect '/path' in the URL for all potential apps? Thanks in advance. -- View this message in context: http://www.nabble.com/apache-tomcat-modjk-URL-path-question-tp25976682p25976682.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org