I have a question about how servers communicate with each other and how it takes up bandwidth. I’ll use an example to better explain my question.
I have two sites: http://www.jojoedad.com and resources.jojoedad.com. Each site resides on a separate server (with different IPs and on different machines). “www| is used mainly for handling front-end tasks such as serving up different web pages. “resources” stores a whole bunch of video files and is meant to only serve up large video files.
Assume that I code it correctly so only “www” can be accessed by the public and “resources” can only be accessed by calling scripts on “www”. Will large bandwidths of “www” be taken up if users retrieve videos on “resources” through http://www.jojoedad.com like this:
http://www.jojoedad.com/getVideo.php?filename=myVideo.mp4
and in getVideo.php, I have something like this:
header("Content-Type..."); // I didn't fill in details for this line
header("Content-disposition..."); // I didn't fill in details for this line
header("COntent-description..."); // I didn't fill in details for this line
readfile("http://resources.jojoedad.com/video_files/{$_GET['filename']}");
Thanks in advance!
Yes, because as the process is now, you’re doing this:
Meaning you’re doubling your work. The script that puts out the video files should be on
resources.joedad.comand use your header calls plusreadfileusing the path to the video file. An example would be:so it doesn’t have to make a connection to itself.