Nginx, provide file from a folder or create it if not there.
lists at ruby-forum.com
Tue Mar 2 13:12:59 MSK 2010
I'd like to add some extra logic to the location rules in my Nginx
I have an application that creates a binary file based on client
requests. It only sends back a binary file using send_file method. The
contents of the binary file depend on a short key that is sent in the
body of a post request by the client.
When the application makes the file it stores it in a given folder.
I'd like to add a rule in Nginx so that depending on the key in the body
it would either directly provide a file with a given name.bin (if
existing in the folder). But if it is not existing it would actually use
the rails app to generate it.
I know I can check the body of the request with $request_body and use
that in an if clause inside location rules. But how to make the decision
to provide the file if existing or send the request to rails otherwise?
Posted via http://www.ruby-forum.com/.
More information about the nginx