: Rehosting content from another server We have a set of static pages that will augment a customer's existing site. The pages will not reside on the customer's servers for logistical reasons
We have a set of static pages that will augment a customer's existing site. The pages will not reside on the customer's servers for logistical reasons and because we need to maintain control of the content. The plan is for the customer to set up a mod_rewrite rule that will funnel certain types of URLs to a single server-side handler script that will grab the appropriate file from a CDN and just output its content. This illustrates the approach:
<?php echo(file_get_contents(str_replace($customer_host, $cdn_host, $_SERVER['REQUEST_URI']))); ?>
Can anyone think of pitfalls or offer up a different approach? Is there some way to circumvent a script altogether?
More posts by @Jennifer507
1 Comments
Sorted by latest first Latest Oldest Best
Your are planning on implementing a type of "reverse proxy" in PHP. There is an Apache module that does this already: mod_proxy
You might find it easier to configure mod_proxy as a reverse proxy on your client's server rather than use PHP. mod_proxy can even be activated through rewrite rules for specific pages or directories:
RewriteEngine On
RewriteRule ^/content/(.*) cdnhost.example.com/ [P]
ProxyPassReverse /content/ cdnhost.example.com/
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.