• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

I have trouble in setting proxy in apache server

 
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was basically trying to implement a sample project and following the instructions as given in the site "http://code.google.com/webtoolkit/doc/1.6/DevGuideServerCommunication.html#DevGuideRPCDeployment".My tomcat 5.5 is up and running.When i hit the URL "http://localhost:8080/stockwatcher/stockwatcher/stockPrices" i get HTTP Status 405 - HTTP method GET is not supported by this URL.I am ok with above 405 error.
Now I have installed apache tomcat2.2 (httpd-2.2.21-win32-x86-no_ssl.msi) by downloading from apache website.I want to implement reverse proxy so i do as the site says
("http://code.google.com/webtoolkit/doc/1.6/DevGuideServerCommunication.html#DevGuideRPCDeployment"). So the general idea is to setup Apache to redirect ONLY requests to your servlets. That way Apache will serve all the static content, and your Tomcat server will only be used for service calls.
Steps which i did)
1) uncommented "LoadModule proxy_module modules/mod_proxy.so" from httpd conf file
2)added

ProxyPass /stockwatcher/stockwatcher/stockPrices http://localhost:8080/stockwatcher/stockwatcher/stockPrices


in httpd.conf file
3) Remember i told earlier that when i hit "http://localhost:8080/stockwatcher/stockwatcher/stockPrices" url i get 405. That is what iexpect when i hit "localhost:80/stockwatcher/stockwatcher/stockPrices"
4)My apache tomcat runs on port 80, so i expect when i hit "localhost:80/stockwatcher/stockwatcher/stockPrices", it should redirect me to
"http://localhost:8080/stockwatcher/stockwatcher/stockPrices"
5)My apache tomcat comes up fine,because when i try to access static content,it displays the html page
6)But when i give "http://localhost:80/stockwatcher/stockwatcher/stockPricesl"
I

get below error
Server Error (500 internal server error)
The server encountered an internal error or misconfiguration and was
unable to complete your request.
Please contact the server administrator, blah blah ......


Please help. . I have been trying for hours and searched the apache sitoo ,but iam unable to get it working
 
Saloon Keeper
Posts: 28319
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, a proxy does not redirect you. Apache redirection actually returns a status with the redirect target URL in it to your client and the client then re-issues the request using that URL, if I'm not mistaken.

In contrast, the proxy actually rewrites the request to make it look like it originated from Apache itself, then forwards the rewritten request to Tomcat (or wherever). The ProxyPassReverse undoes that action so that the client thinks that Apache handled the request directly.

When mixing Apache and Tomcat, always pay attention to the format of the error page. Tomcat's error pages have distinct colorings among other things, and when you get a 500 error from Tomcat, that means that the proxy is more or less working, but that there was probably an Exception thrown in the Tomcat webapp's program code.
 
Maan Suraj
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah thanks for the info Tim.But the problem was that i only included "LoadModule proxy_module modules/mod_proxy.so". Later, i realised i might have to include "LoadModule proxy_http_module modules/mod_proxy_http.so" this as well.Now it redirects properly.Need to investigate the difference between those two modules.

Though above works fine, just wanted to know when do i need to use "AddModule mod_proxy.c". I saw it in apache site. But when i try to add this line in my httpd.conf file, the server itself doesnot start for me. I dont know why.Any idea?

 
Tim Holloway
Saloon Keeper
Posts: 28319
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm afraid that I get mine the lazy way. I'm using the OS-supplied httpd server and the requisite modules are all either setup properly in the core bundle or neatly packaged as self-configuring add-on packages. However, failing to load a module normally causes an immediate error, not the kind of subtle stuff you seem to be encountering.

Here is everything I use to proxy to a secondary server:



 
Maan Suraj
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well thanks Tim.

I am awaiting more responses from others :-)
 
Where all the women are strong, all the men are good looking and all the tiny ads are above average:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic