Any way to read file contents into a variable?

want to store urls (locations) in files and issue redirects based on
file contents. $request_body looks like it’s only available on proxy…

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,43668,43668#msg-43668

On Wed, Jan 20, 2010 at 3:55 PM, arianna [email protected] wrote:

want to store urls (locations) in files and issue redirects based on file contents. $request_body looks like it’s only available on proxy…

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,43668,43668#msg-43668


nginx mailing list
[email protected]
http://nginx.org/mailman/listinfo/nginx

There are third party modules which may read a value of a location
(which could refer to files) into a variable.

Why do you really need this though? Would seem easier to setup a
backend application of some kind which sends X-Accel-Redirect or the
Location: header as needed.

– Merlin

isn’t that like saying “isn’t it easier to setup a backend application
to render the page?”. at a very minimum we’re looking at a database hit
each time we lookup the location…we’d like to offload everything to
our speedy workhorse…nginx :slight_smile:

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,43668,46099#msg-46099

Hi,

arianna wrote:

want to store urls (locations) in files and issue redirects based on file contents. $request_body looks like it’s only available on proxy…

The eval module is probably what you want here -

http://github.com/vkholodkov/nginx-eval-module

I would suggest storing the URLs in a memcached server rather than on
file (or do both and check the file only if the memcached version isn’t
available).

You might also want to look at the memc module in order to do the
setting of the memcached variable using Nginx (rather than a backend
application).

http://github.com/agentzh/memc-nginx-module

Marcus.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs