aspose file tools*
The moose likes Tomcat and the fly likes Sending an HTTP request from behind Apache Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Sending an HTTP request from behind Apache" Watch "Sending an HTTP request from behind Apache" New topic
Author

Sending an HTTP request from behind Apache

Jenny Goodwin
Greenhorn

Joined: Mar 07, 2011
Posts: 8
Hi,

I've developed a web application with mobile clients. The web application is deployed on Tomcat 6 which is hooked up to Apache 2.2 with mod_proxy.

During execution, the web application sends an HTTP request to an sms messaging service (BulkSms), and an sms is sent to my cell phone to invoke the mobile client application.

The system works well when Tomcat is running by itself. However, when Apache is also running, I get an error message and my sms request fails to arrive at BulkSms.

A lot of this is new territory for me, but I think I may have a configuration issue which is preventing my request from being dispatched.

I've tried to research this on the web, but I haven't found anything useful.

I am now completely stuck, and I would be very grateful for any ideas.


Thanks

Jenny
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16014
    
  20

I think we'll need more information than that. If a J2EE webapp is using HTTP to send SMS to an external gateway webapp, there's no way Apache fronting the J2EE app should make any difference at all. Most likely you have some sort of firewall changes that were made when Apache was brought in, but it would help if you could provide us with the exact text of the error message.


Customer surveys are for companies who didn't pay proper attention to begin with.
Jenny Goodwin
Greenhorn

Joined: Mar 07, 2011
Posts: 8
Hi Tim!

WOW! I hadn't expected such a fast reply!

First of all, just to clarify, I'm not using HTTP to send SMS. All I'm sending is a standard HTTP post request to the BulkSms website, and they send an sms to my cell phone to trigger the mobile client application.

When I first ran the system with Apache running, I got a 401 (authorisation/authentication) error:


As the error specified the BulkSms url, I initially thought that this was where the error was occurring, but when I inquired about this, BulkSms replied that they had no record of a 401 error having occurred.

After further trials, I removed the password file from Apache and ran the system again. This time I got a different error:


The error message changed as a result of changing Apache, and this led me to think that I had a configuration problem. This is the first time I've configured a server, so I'd better show you what I did.

Tomcat's server.xml file already had this line:


In Apache's httpd.conf file, I made sure that the proxy modules were un-commented:


I then added the following lines to configure the proxy:



Finally, I configured the Windows firewall to allow tcp and udp exceptions for httpd.exe on ports 80 and 443, all scoped for any computer.

As I said before, most of this is new territory for me. I'm still struggling with some of the basic concepts, so any advice you can offer will be very much appreciated.


Tim, thanks for taking an interest

Jenny
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16014
    
  20

Timing is everything. I usually make my rounds in the morning local time on business days. I may check in at other times, but that depends on what other distractions I have.

I should clarify that "HTTP SMS request" is just my shorthand for "using an HTTP service to send SMS". What you're doing is basically a REST request to the SMS gateway.

An HTTP 401 is a security challenge. Normally it's what you get when a server has implemented BASIC authentication, and it's what causes your browser to pop up a login dialog box.

How you then ended up getting a "File not found exception" on a URL puzzles me, though. Especially since this is supposed to be an outbound URL request.

Your Apache-to-Tomcat proxying appears OK to me.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sending an HTTP request from behind Apache