Welcome! Log In Create A New Profile

Advanced

Nginx, provide file from a folder or create it if not there.

comopasta Gr
March 02, 2010 05:20AM
Hi,

I'd like to add some extra logic to the location rules in my Nginx
server.

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?

Cheers.
--
Posted via http://www.ruby-forum.com/.

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Nginx, provide file from a folder or create it if not there.

comopasta Gr March 02, 2010 05:20AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 320
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready