I am confused about the proxy_pass directive. Suppose, i need to serve
an
mp4 file from Origin server and using proxy_pass directive in Edge
server,
whose resources(I/o,bandwidth,Ram) will be used ? Edge or Origin ?
Following is the topology to server mp4 file :-
client (request mp4 file) --> edge(ip is 1.2.3.4 so don’t serve it
locally
and forward it to origin) --> origin (serves the requested mp4 file).
Now, when origin serves that mp4 file, will the mp4 file first goes edge
server and than client is served via edge proxy ? Also mp4 is a big file
and i am curious to know whose HDD i/o will be used to serve this file ,
Edge/Origin ?
On Sat, Jul 19, 2014 at 02:23:49PM +0500, shahzaib shahzaib wrote:
Hi there,
I am confused about the proxy_pass directive. Suppose, i need to serve an
mp4 file from Origin server and using proxy_pass directive in Edge server,
whose resources(I/o,bandwidth,Ram) will be used ? Edge or Origin ?
Everyone’s.
Following is the topology to server mp4 file :-
client (request mp4 file) --> edge(ip is 1.2.3.4 so don’t serve it locally
and forward it to origin) --> origin (serves the requested mp4 file).
You have “client” (= web browser), which talks to “nginx” (= web
server),
which is configured to proxy_pass some requests to “upstream” (= other
web server).
client asks nginx for content, nginx sends content to client. So the
full file goes from nginx to client.
If nginx needs to proxy_pass, then before nginx sends content to client,
nginx asks upstream for content, and upstream sends content to nginx. So
the full file also goes from upstream to nginx.
upstream never talks to client directly, in this topology.
If nginx needs to proxy_pass, then before nginx sends content to client,
nginx asks upstream for content, and upstream sends content to nginx. So
the full file also goes from upstream to nginx.
Means, both server’s i/o will be used if the requested file to upstream
is
720p.mp4?
Means, both server’s i/o will be used if the requested file to
upstream is
720p.mp4?
Yes, what you’re looking for is a way to client-rewrite the address the
source is coming from.
1.2.3.4 → request xx.mp4 → edge 5.6.7.8 (I don’t have that file) →
send
client address of origin and tell client to re-initiate file request
with
origin address.
client address of origin and tell client to re-initiate file request with
origin address.
How? don’t ask me
Is there a legal problem doing that? Why the smiley?
An idea just popping out of my mind:
To redirect the client to the origin server, a 302 answer will do,
won’t
it?
If you want to restrict access to the content server (and avoid
clients
to directly request content there by storing its address without having
been redirected there by edge, for example when using load-balancing), before redirecting the client, on the origin server, you might record
requests incoming from edge servers (trusted/whitelisted sources), pass
the
client IP address with a X-Forwarded-For (name might not be exact)
header
field and allow a time-limited session for that client.
No I’d do it simple by using HTTP-EQUIV=“REFRESH” as a response with an
origin address.
Redirecting that way might work, although it looks a bit ugly to my
eyes. It also seems to be not compliant to WCAG if you care about
accessibility. Well, plain old HTML 4.01…
Is it cross-compatible? I read stuff towards the contrary regarding
Firefox.
HTTP provides loads of ways to handle redirections in a standard
fashion:
301, 302 or even 303, 307 if you know what you are doing.
Anyway, the person asking the question will pick his/her choice.
The Proxying server does not download the entire file ;save it to disk
and
then serve from that .
The proxy simply buffers the content (which is config manageable) and
serve
the end user (browser ) .So the proxy will not face a high disk i/o load
like the origin …
1.2.3.4 → request xx.mp4 → edge 5.6.7.8 (I don’t have that file) → send
client address of origin and tell client to re-initiate file request
with
origin address.
@itpp, you’re always the light of hope in darkness :-).Thats the exact
solution i need, rewrite is not recommended in our solution because
we’re
using View directive of bind where same domain test.com will resolve to
edge as well as origin server on the basis of client’s ip. So i cannot
rewrite test.com back to test.com. You mentioned the solution
HTTP-EQUIV=“REFRESH” . Is that fine to use this method also, could you
tell
me how to use it with origin ip in nginx ? So client will resend the
request to origin instead of edge.
rewrite test.com back to test.com. You mentioned the solution
HTTP-EQUIV=“REFRESH” . Is that fine to use this method also, could you
tell
me how to use it with origin ip in nginx ? So client will resend the
request to origin instead of edge.
Posted at Nginx Forum:
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.