September 29, 2017 03:30PM
Hi Lucas,

As long as the cached files (with the metadata at the beginning) reside in the directory specified with the proxy_cache_path directive, they are fine. The NGINX-proxy, which added them there in the first place, can serve the content correctly, after skipping the right amount of metadata bytes.

In my case, I have a background application, which might copy the cached file to an alternate location. For example, a file movies/welcome.mp4 may be originally cached by NGINX-proxyon /disk1/cache as /disk1/cache/movies/welcome.mp4 (For the moment, let us forget the md5-based cache path for simplicity). In my use-case, the file may either stay there itself, or sometimes, my application may copy it to another location - say /disk2/cache/movies/welcome.mp4 or say, /disk3/cache/movies/welcome.mp4, say for some kind of disk usage balancing.. The application exposes /disk1/pubroot/cache/movies/welcome.mp4 as the published location.

In this model, only the originally cached file at /disk1/cache can be served properly by the NGINX-proxy.

The files in any of the other locations cannot be served by NGINX properly. It cannot serve as a server, as the copied file contains metadata. Even if I have other proxy-cache-paths defined for the alternate locations (/disk2/cache or /disk3/cache), the NGINX-proxy also cannot serve them as the corresponding in-memory metadata will not have the entries for these files. The files in those paths, would have been physically copied "under the hood" by another process, and not NGINX.

Thanks
Rajesh
Subject Author Posted

Any method for NGINX (as a web-server) to skip metadata and serve content from cached file?

rnmx18 September 29, 2017 05:58AM

Re: Any method for NGINX (as a web-server) to skip metadata and serve content from cached file?

Reinis Rozitis September 29, 2017 09:18AM

Re: Any method for NGINX (as a web-server) to skip metadata and serve content from cached file?

rnmx18 September 29, 2017 12:33PM

Re: Any method for NGINX (as a web-server) to skip metadata and serve content from cached file?

Lucas Rolff September 29, 2017 12:40PM

Re: Any method for NGINX (as a web-server) to skip metadata and serve content from cached file?

rnmx18 September 29, 2017 03:30PM

Re: Any method for NGINX (as a web-server) to skip metadata and serve content from cached file?

Lucas Rolff September 29, 2017 03:56PM

Re: Any method for NGINX (as a web-server) to skip metadata and serve content from cached file?

rnmx18 September 29, 2017 04:16PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 316
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