Mobile app version of vmapp.org
Login or Join
Jennifer507

: 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

@Jennifer507

Posted in: #Cdn #ModRewrite #WebHosting

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?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Jennifer507

1 Comments

Sorted by latest first Latest Oldest Best

 

@Heady270

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/

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme