On Wed, Sep 12, 2012 at 3:37 PM, Bhattacharya, Sudip <sudip.bhattacha...@genpact.com> wrote: > Hi Tom, > > Can you explain further on the "Manual Synchronization" process? > Do I have to manually copy paste the static files from backend server to my > local cache folder(create a mirror copy) for achieving this? > Or are you referring to hitting all the URLs manually to force Apache to > cache them before users end start using the proxy. > > Also how can I check for local files and conditionally proxy to the backend?
So, this can only happen in a few scenarios. At $JOB, we have reverse proxies which proxy back to application servers. The application servers used to be directly internet facing, and so they have every static file that is needed to be served locally on the application server disks. However, it is very wasteful and slow to reverse proxy to static files, and to tie up these expensive application server web processes (which are massive compared to the lightweight processes used on the reverse proxy). Therefore, we checkout an identical copy of these static files onto the reverse proxy, so that they can be served directly to clients. We then can use various methods to determine whether to proxy a request, or to serve the file off disk. If the static files are all in one sub directory, something like this works great on the proxy: ProxyPass /static/ ! ProxyPass / http://backend/ Otherwise, rewrite rules can do the trick RewriteCond %{REQUEST_URI} ^(.*)$ RewriteCond /path/to/docroot/%1 !-f RewriteRule ^/(.*) http://backend/$1 (Brief description: capture the request uri in back-reference %1, check to see if that file does not exist on disk, in which case proxy to the backend) Obviously, you then have to keep files in sync between proxy and backend, and nothing automatically happens as it would with caching. wrt configuring caching per file type, it is difficult in apache to do things based upon the proxied response (or if there is a simple way, I'm missing it). You would want to examine the returned mime type, and then set appropriate cache-control headers. If I'm being dense and missing an obvious solution, someone please point it out. Cheers Tom --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org