What can i do if i need to send file which is not on current server and i don't want to waste the time of client for downloading on my server?

I can't use proxy_pass to file server because i need to save this file on the main server to prevent re-downloading again and again in case this file is very popular - it will cost a lot.

I'm using download.php and X-Accel-Redirect. I tried to set the real Content-Length of file - it did't help, nginx ignore content-length header from my php script, it gives actual size of downloading file.

I tried chunked_transfer_encoding on; + header('Transfer-Encoding: chunked'); didn't help - the same situation

So in other words,

Client requests file 'test.mp4' from 'server_1' 'server_1' downloads a file from 'server_2' using http streaming. So i can stream from 'server_2' but i don't need. I need send this file to the client while it's downloading...

  • Why can't server 1 serve the file directly? Please give more detail about your architecture. – Michael Hampton Apr 23 at 1:24
  • Because server_1 retrieve file from backup on Sia Network. – pyAndy Apr 23 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.