Rewrite: fixing Metadot Kluginess

Igor Sysoev is at rambler-co.ru
Thu Jul 23 11:14:02 MSD 2009


On Thu, Jul 23, 2009 at 04:10:48AM +0200, Paul Hamann wrote:

> Greetings.  I'm implementing portal software called Metadot.  It was
> orginally Perl -- ported to Rails about 1 yr ago.  There's a bunch of
> Perl-isms and silliness that makes it somewhat dependent on Apache2 /
> fcgi.
> 
> I'm trying to use Nginx to proxy/balance dynamic requests to multiple
> Apache2/Passenger servers.  I want Nginx to serve up all static content
> so that Aapche2 can serve just rails.  They put attachments and images
> in a separate directory outside the rails root.  Then they pre-pended
> the filename with 8 digits made up of zeros and the file's id.  I want
> to rewrite specific file formats to their actual filenames and dirs.
> 
> Example for user uploaded images. {png | ico | jpg | gif | etc.....}
> 
> request comes in as: /__metadot__/image_library/image.gif
> 
> maps to: ../../metadot-on-rails-attachments/00000001/00000022-image.gif
> 
> 22 is the file id and image.gif is the [already unique] filename.
> metadot-on-rails-attachments is at the same level as the rails root, not
> inside it.
> 
> Please help! I've been lost on this all day.

If only backend knows how to map URI to file system, you may
proxy such request to the backend and the backend should return

X-Accel-Redirect: /metadot-on-rails-attachments/00000001/00000022-image.gif

However, I prefer direct mapping without backend participation.


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list