0

I have a question regarding the behavior of proxy_pass in nginx. Let's suppose the nginx config has the following location property:

location /a.mp4 {
    proxy_pass http://3rd_party_domain/a.mp4;
}

(Note that the syntax might be incorrect, but you can get what I'm trying to say)

Question: When an user tries to download a.mp4 on my domain, where the actual traffic comes from? I can think of the following possible scenarios:

#1 3rd_party_domain -----> client
#2 3rd_party_domain -----> my_domain -----> client

I hope #1 is the case here, but wondering whether actually behavior is something like #2.

Thanks!

Lunejy
  • 353
  • 1
  • 3
  • 8

2 Answers2

0

It goes through my_domain, the client uses my_domain like a "tunnel".

  • thanks. then what should i use instead of 'proxy_pass' to completely redirect the given request to the 3rd party domain? – Lunejy Dec 18 '15 at 15:52
  • You have to include the the video source in your html page using `http://3rd_party_domain/a.mp4`. In this case, the browser will connect to 3rd_party directly. – Mihaly Vukovics Dec 18 '15 at 15:54
  • There's no way to do that via nginx? Basically, I want to hide the 3rd_party_domain url, so a little bit hesitate to embed the 3rd-party-domain url in the html page. What I'm thinking is: client ----> my_domain --(redirect)--> 3rd_party_domain ----(eventually)--> client. – Lunejy Dec 18 '15 at 15:57
  • You can olnly hide 3rd_pary with proxypass. Every other method like embedd, redirect will show the original source. – Mihaly Vukovics Dec 18 '15 at 16:02
0

An old question, but I had the same scenario and found a different solution. If you're using Google Cloud Storage or AWS S3, You can use a signed-URL download files via a load-balancer, which is connected to a bucket as a backend service.

Using singed URL

The file name can be static - using file metadata

Or dynamic - using dynamic file name

Gilad Sharaby
  • 910
  • 9
  • 12