3

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?

Steve
  • 4,033
  • 5
  • 32
  • 29
  • I don't think so, one the request is made client will be redirected before the image is serverd from that domain. – Davor Lucic May 07 '10 at 15:31
  • I stumbled upon one of your old question, and i am having a tiny problem with mine here http://stackoverflow.com/q/29898156/1478789, basically i am trying to do image rewrite just like you without success. Can you perhaps help me? I really appreciate it. Thx – Jeremy Apr 28 '15 at 00:18

2 Answers2

2

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.

Gumbo
  • 643,351
  • 109
  • 780
  • 844
0

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.

David Larrabee
  • 384
  • 1
  • 9