File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes Apache to Tomcat forwarding not working properly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Apache to Tomcat forwarding not working properly" Watch "Apache to Tomcat forwarding not working properly" New topic
Author

Apache to Tomcat forwarding not working properly

G Chhabra
Greenhorn

Joined: May 03, 2010
Posts: 3
Hi,


I am facing some problem with Apache to Tomcat forwarding. I have Tomcat (6.0.18) behind Apache (2.2). I want to use ‘https’ for receiving request from the client. This request, when forwarded by Apache to Tomcat, will use ‘http’. My application’s name is ‘abc’, which is deployed in Tomcat’s webapps dir. Both Tomcat & Apache are on the same machine. There is one more requirement: When a user just types the IP, it should, by default, forward it to the application’s (abc) login page i.e., both the below mentioned URL’s should point to the same page.

https://IP/
http://IP:8080/abc

I added the following lines in the httpd.conf file:
-----------------------------------------------------
ProxyPass /abc http://IP:8080/abc/implement
ProxyPass / http://IP:8080/abc/implement
-----------------------------------------------------

Now there are two issues:
-----------------------------------------------------
1. When I try to use the https URL (https://IP/), it opens up the login page but the images are not visible. If I try the http one (http://IP:8080/abc/), then the page works fine.

I thought of using the blank (appearing so) image’s URL (https://IP/abc/abc/images/logo_login.gif >>> abc 2 times is not a typo; the deployed directory’s name is ‘abc’ & there is a dir named ‘abc’ inside ‘abc’) and see where it’s pointing to. When I tried accessing it, it too was pointing to the same login page where http://IP:8080/abc/ OR https://IP/ are pointing.

These are few results that might help you to understand my problem:
https://IP/ (No logo; only the login page)
https://IP/abc/abc/images/logo_login.gif (No logo; only the login page)
(I have also noticed that whatever I append in the https URL after https://IP/abc/ it takes me to the login page with no image)

http://IP:8080/abc/implement (Works perfectly. Login page with logo)
http://IP:8080/abc/implement/abc/images/logo_login.gif (Login page with logo. I had no idea what this would display but at least I did not imagine that it would display ‘login + image’)
http://IP:8080/abc/abc/images/logo_login.gif (Shows ONLY logo as it ideally should)


2. If we use IE6 to open https URL, then a warning box pops-up before the login page appears (without images). This behavior is absent in IE8.

The warning message states “line 56 Object expected”.
-----------------------------------------------------

Can anyone please guide me?


Regards,
GC


[Thumbnail for Login page with blank image.JPG]

G Chhabra
Greenhorn

Joined: May 03, 2010
Posts: 3
Hi,


I am now able to see image as well on the login page. My new ProxyPass settings are:
------------------------------------------
ProxyPass /abc/abc/images http://IP:8080/abc/abc/images
ProxyPass /abc http://IP:8080/abc/implement
ProxyPass / http://IP:8080/abc/implement
------------------------------------------
Please don't get confused with the 2 abc mentioned above in thr URL; one is the deployed application's dir name and the following abc is a dir just inside it.

Now the problem I am facing is that when I try to access either 'https://IP' or 'https://IP/abc', I see some a yellow icon at the bottom left of my browser. On clicking it, it says
-------------------------------------------
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Timestamp: Tue, 4 May 2010 09:22:02 UTC
Message: Object expected
Line: 57
Char: 2
Code: 0
URI: https://IP/csa
-------------------------------------------

Also, when I enter inside the login page, I don't get a proper page; instead I see the actual code written on the browser's screen.

On the other hand, if I try the 'http' URL (http://IP:8080/abc/implement), everything works fine without any error message, anywhere. Looks like there is still some problem with my Apache to Tomcat communication.


Regards,
GC
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Apache to Tomcat forwarding not working properly