Re: Apache 2.0-Mongrel Proxy problems

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

 



On 9/30/07, Bruce Hodo <bchodo@xxxxxxxxxxxxx> wrote:

>          <Directory /var/www/rails/myapp/public/>
>          Options FollowSymLinks +Includes +ExecCGI
>          AllowOverride None
>                  Order allow,deny
>                  Allow from all
>                  RewriteEngine On
>                  RewriteRule ^$ index.shtml [QSA]
>                  RewriteRule
> "^/(images|stylesheets|javascripts|pictures|graphics)/?
> (.*)" "$0" [L]
>                  RewriteCond %{REQUEST_FILENAME} !-f
>                  RewriteRule ^/(.*)$ http://localhost:8000/$1 [P,L]
>          </Directory>

> -turned on rewritelog. here are the results for a www.myapp.com/state/list
> request:
> (3)  add path info postfix: /var/www/rails/myapp/public/state -> /var/
> www/rails/myapp/public/state/list
> (3)  strip per-dir prefix: /var/www/rails/myapp/public/state/list ->
> state/list
> (3)  applying pattern '^$' to uri 'state/list'
> (3)  add path info postfix: /var/www/rails/myapp/public/state -> /var/
> www/rails/myapp/public/state/list
> (3)  strip per-dir prefix: /var/www/rails/myapp/public/state/list ->
> state/list
> (3)  applying pattern '^/(images|stylesheets|javascripts|pictures|
> graphics)/?(.*)' to uri 'state/list'
> (3)  add path info postfix: /var/www/rails/myapp/public/state -> /var/
> www/rails/myapp/public/state/list
> (3)  strip per-dir prefix: /var/www/rails/myapp/public/state/list ->
> state/list
> (3)  applying pattern '^/(.*)$' to uri 'state/list'
> (1)  pass through /var/www/rails/myapp/public/state
>
> It seems that the rewrite is working up to the rewritecond statement.
> It parses the statement pattern correctly, but the file state/list
> does not exist, so the condition "!-f" should pass the request to
> Mongrel, but it seems to pass it to Apache, who doesn't find the file
> "state/list" and gives a 404 error, unless I'm reading the logs wrong!

Yes, you are reading the logs wrong. The fact is, the regular
expression  '^/(.*)$' does not match the uri  'state/list' (no leading
slash). So the RewriteCond is never even evaluated. (I think perhaps
your RewriteLogLevel is set too low, which is why the log is difficult
to interpret.)

My principal recommendation is to take the whole mod_rewrite
configuration outside the <Directory> section. Rewriting inside
<Directory> introduces a whole bunch of extra stripping and adding of
path-prefixes that makes mod_rewrite even more confusing than it would
ordinarily be. You'll need to make some adjustments to the config, but
they should be evident if you use the RewriteLog to check what
variables mod_rewrite is seeing.

And you can come back again here if you still have problems after you
have tried to make all the relevant adjustments.

(Also, if you want to use caching, you should move up to 2.2.)

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[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