Will mod_rewrite to an image on another domain cost bandwidth for the original domain?
I want to use mod_开发者_开发问答rewrite to include a date in an image filename, so browsers will know to refresh an image anytime it's changed, despite any expires headers.
My rewrite rule is
RewriteRule ^images/[0-9]+/(.*)$ http://my-amazon-bucket.s3.amazonaws.com/$1
which should turn something like
http://example.com/images/2010-08-11/example-image.jpg
into
http://my-amazon-bucket.s3.amazonaws.com/example-image.jpg
Will the first domain be carrying the bandwidth of the entire image file?
Your rule will result in a response that tells the client to send another to the target location to retrieve the resource from there (see HTTP response status code 302).
Only if you’re using a proxy (using the P flag, see also mod_proxy) your server would request the resource from remote and pass it to the client, resulting in doubling the in- and output.
the first client gets the request, but then passes it onto the second. So the bandwidth to provide the image would be handled by the second host.
精彩评论