Welcome! Log In Create A New Profile

Advanced

Add files to cache manually

May 20, 2021 02:42PM
I have nginx setup to proxy file uploads. The file upload streams into nginx, goes into my upstream, and then the upstream streams it to Amazon S3 (after some basic processing). In addition to proxying the upload, I also want to proxy the download, with some caching on the nginx side.

It would be ideal if I could add the uploaded file directly to the nginx cache after it is uploaded, so nginx does not have to re-download it from S3 immediately after it was uploaded there.

One option is to keep a copy of the file on disk (outside of the nginx cache). Then use something like try_files to read it, and have that response be cached by nginx. But then I end up with 2 of the files on disk (one in my try_files directory, and one in the nginx cache). I also need to manually manage the files stored in my try_files directory (to delete them after they enter the nginx cache). This is kind of ugly.

If I can reverse engineer the nginx cache file format, is there a way to tell the nginx cache manager that it exists? Right now, it seems like the cache manager will disregard any files in the nginx cache that it doesn't know about.
Subject Author Posted

Add files to cache manually

foobug May 20, 2021 02:42PM

RE: Add files to cache manually

Reinis Rozitis May 21, 2021 07:58AM

Re: RE: Add files to cache manually

foobug May 21, 2021 12:18PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 76
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready