0

Say I have an origin site and structure of media like so:

https://watch.example.com/2017-04-06/training.mp4, which is a static 5GB that will never change.

Now at a remote location with very poor internet, I want to provide a caching proxy which mounts a 4TB disk (that I've sent in advance) that has these files sitting in a directory like /media/2017-04-06/training.mp4, so when the http://cache.local/2017-04-06/training.mp4 is accessed, it plays back the locally cached content. If it fails, the caching proxy might download from https://watch.example.com/2017-04-06/training.mp4 or the media player client might be coded to fallback to the canonical https://watch.example.com/2017-04-06/training.mp4.

So after investigating nginx, it unfortunately saves the content and headers in a md5sum arrangement at proxy_cache_path, which makes my aim to pre-cache or prime the cache by disk difficult.

Is there some other simpler solution I am missing?

1 Answer 1

0

Something like this should work:

server {
  server_name example.com;
  root /media;

  location / { try_files $uri $uri/ @backend; }

  location @backend {
    proxy_pass http://watch.example.com;
  }
}

As it is this config won't cache anything it doesn't already have, but you could add in the relevant proxy_cache settings if you want.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .