RE: Rails via mongrel, always getting 404

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I found the problem

 

https://rails.lighthouseapp.com/projects/8994/tickets/4690-mongrel-doesnt-work-with-rails-238

 

The fix I used is here

 

http://gist.github.com/471663

 

all is well

 

From: Brad Hodges [mailto:brad@xxxxxxxxx]
Sent: Saturday, November 13, 2010 6:18 AM
To: 'users@xxxxxxxxxxxxxxxx'
Subject: Rails via mongrel, always getting 404

 

I can’t get my Rails app served up on Apache2.2 running on Windows via mongrel.

 

At some level it is working,  I can get my Rails app to receive requests from mongrel,  and the Rails app appears to be happy,  but Apache always returns 404 not found.

 

I’m using mod_proxy like so:

 

NameVirtualHost *:80

<VirtualHost *:80>

ServerName pdftk.neeis.com

DocumentRoot E:/DEV/pdftk/public/

      XSendFile On

      XSendFilePath E:/DEV/pdftk/public/

<Directory "E:/DEV/pdftk/public/" >

          Options -Indexes FollowSymLinks MultiViews

          AllowOverride None

          Order Deny,Allow

          Allow from any

      </Directory>

      RewriteEngine On

      RewriteRule ^/$ /index.html [QSA]

      RewriteRule ^([^.]+)$ $1.html [QSA]

      RewriteRule "^/(images|stylesheets|_javascript_s)/?(.*)" "$0" [L]

      RewriteCond %{DOCUMENT_ROOT)/%{REQUEST_FILENAME} !-f

      RewriteRule ^/(.*)$ balancer://pdftk_cluster%{REQUEST_URI} [P,QSA,L]

      <Proxy balancer://pdftk_cluster>

            BalancerMember http://pdftk:3005

            BalancerMember http://pdftk:3006

      </Proxy>

      ProxyPass / balancer://pdftk_cluster

      ProxyPassReverse / balancer://pdftk_cluster

      ProxyPreserveHost On

      ErrorLog E:/DEV/pdftk/log/error.log

      CustomLog E:/DEV/pdftk/log/access.log combined

      LogLevel debug

</VirtualHost>

 

There are no errors  in the Apache error log,  all I see is the load balance, the setup / tear down of the mongrel proxy request, etc.  ,  and the Rails log is happy, it thinks it’s working normally.   The Rails app just processes some pdf building stuff,  that takes about 1600ms, and sends back the pdf.  But Apache, as soon as it hands off the proxy request to mongrel, is returning 404 to the client,  even though the proxy request completes correctly, 1600ms later,  without error.    Why would Apache not wait for the Proxy to complete?  Why could it be returning a 404 error immediately ?

 

I normally deploy Rails under passenger on Solaris,  and I’ve never had construct  httpd.conf from scratch until now,  so this is likely something obvious and simple.

 

The rest of my httpd.conf:

 

(if this config seems dangerous,  this machine is not accessible via the public internet,  I started opening up everything in an attempt to track down this 404 problem)

 

 

ServerRoot "C:/Program Files/Apache Software Foundation/Apache2.2"

Listen 172.28.1.10:80

 

LoadModule actions_module modules/mod_actions.so

LoadModule alias_module modules/mod_alias.so

LoadModule asis_module modules/mod_asis.so

LoadModule auth_basic_module modules/mod_auth_basic.so

LoadModule authn_default_module modules/mod_authn_default.so

LoadModule authn_file_module modules/mod_authn_file.so

LoadModule authz_default_module modules/mod_authz_default.so

LoadModule authz_groupfile_module modules/mod_authz_groupfile.so

LoadModule authz_host_module modules/mod_authz_host.so

LoadModule authz_user_module modules/mod_authz_user.so

LoadModule autoindex_module modules/mod_autoindex.so

LoadModule cgi_module modules/mod_cgi.so

LoadModule dir_module modules/mod_dir.so

LoadModule env_module modules/mod_env.so

LoadModule include_module modules/mod_include.so

LoadModule isapi_module modules/mod_isapi.so

LoadModule log_config_module modules/mod_log_config.so

LoadModule mime_module modules/mod_mime.so

LoadModule negotiation_module modules/mod_negotiation.so

LoadModule proxy_module modules/mod_proxy.so

LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

LoadModule proxy_balancer_module modules/mod_proxy_balancer.so

LoadModule proxy_connect_module modules/mod_proxy_connect.so

LoadModule proxy_ftp_module modules/mod_proxy_ftp.so

LoadModule proxy_http_module modules/mod_proxy_http.so

#LoadModule proxy_scgi_module modules/mod_proxy_scgi.so

LoadModule rewrite_module modules/mod_rewrite.so

LoadModule setenvif_module modules/mod_setenvif.so

LoadModule xsendfile_module modules/mod_xsendfile.so

 

 

ServerAdmin brad@tvdco.com

DocumentRoot E:/DEV/pdftk/public/

 

<Directory />

    Options FollowSymLinks

    AllowOverride None

    Order allow,deny

    Allow from all

</Directory>

 

<FilesMatch "^\.ht">

    Order allow,deny

    Deny from all

    Satisfy All

</FilesMatch>

ErrorLog "logs/error.log"

LogLevel debug

<IfModule log_config_module>

    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

    LogFormat "%h %l %u %t \"%r\" %>s %b" common

 

    <IfModule logio_module>

      # You need to enable mod_logio.c to use %I and %O

      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

    </IfModule>

    CustomLog "logs/access.log" common

</IfModule>

 

 

DefaultType text/plain

EnableSendfile On

EnableMMAP Off

ProxyRequests Off

Include ( what’s shown above)

 

 


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux