I have a server running Rails and Tomcat applications with Apache. I currently have a rails app setup to port 80 and a tomcat application on port 8080. I'm attempting to have Apache forward all requests on /uploader to tomcat. The tomcat application works OK when visiting it's own url, but when using the redirect it takes ~60 seconds per request. Here is my httpd file. Any help is really appreciated! Thanks!

<VirtualHost *:80>
  ServerName http://example.com/
  DocumentRoot /Users/lab/WebApplications/app/public   
  PassengerSpawnMethod conservative

    # Speeds up spawn time tremendously -- if your app is compatible. 
    # RMagick seems to be incompatible with smart spawning
    RailsSpawnMethod smart

    # Keep the application instances alive longer. Default is 300 (seconds)
    PassengerPoolIdleTime 1000

    # Keep the spawners alive, which speeds up spawning a new Application
    # listener after a period of inactivity at the expense of memory.
    RailsAppSpawnerIdleTime 0

    # Just in case you're leaking memory, restart a listener 
    # after processing 5000 requests
    PassengerMaxRequests 5000
    # PassengerMaxPoolSize 4
    # PassengerMaxInstancesPerApp 4

 <Directory /Users/lab/WebApplications/app/public>
     AllowOverride all              
Allow from all   
    Options -MultiViews            

ProxyRequests On
ProxyVia On

SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1

    # Redirect to tomcat
ProxyPass         /uploader  http://localhost:8080/FileSplit
ProxyPassReverse  /uploader  http://localhost:8080/FileSplit
  • You might capture some traffic with tcpdump to see which side is sitting on the request for 60 seconds. – Kyle Smith Feb 24 '12 at 19:31
  • It's tenuous, but does changing the localhost to make any difference? – nickgrim Feb 24 '12 at 20:16
  • you want ProxyRequests Off as that is for enabling forwarding proxying rather than (what you need) reverse proxy with ProxyPass – Tom H May 14 '12 at 18:13

Just a guess, but apache is probably waiting for your app to timeout before you get to the ProxyPass. Try moving this to the top of the file, and see if that makes a difference.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.