Getting the URLs right when proxying to apache and mongrel

Maxim Dounin mdounin at mdounin.ru
Tue Sep 4 02:49:27 MSD 2007


Hello!

On Mon, 3 Sep 2007, Cliff Wells wrote:

> On Sun, 2007-09-02 at 19:15 +0000, Maxim Dounin wrote:
>
>> doesn't. So I was forced to wrote something like this
>>
>>      location = /mail {
>>          rewrite ^(.*) https://$server_name$1 redirect;
>>      }
>>      location /mail/ {
>>          rewrite ^(.*) https://$server_name$1 redirect;
>>      }
>>
>
> location ~ /mail(/?) {
>    rewrite ^(.*) https://$server_name$1 redirect;
> }

This particular one won't work correctly, starting anchor missed. The 
problem with this aproach (and with regex locations in general) is 
inefficiency. I've spent too much time developing high-loaded projects to 
allow this even for my homepage. ;-)

So I was talking about efficient and simple way to do the job (and already 
implemented in code, just not configurable for now).

At last, but not least, IMHO it's sort of POLA violation that

     location /blah/ { proxy_pass ...; }

will return "301 Moved" for "/blah" request, while

     location /blah/ { rewrite...; }

won't and return "404 Not found" instead. This should be at least 
documented.

Maxim Dounin





More information about the nginx mailing list