开发者

HTTP 302, 303 or 307 for tracking image url

I'm trying to track whether specific emails we send out are opened and therefore use a hashed url for an image on every email I send out. Currently, when that url is requested, I log the fact that the email has been viewed (based on the hash in the url) and serve the image from the web application server (it's the same image for everybody).

At this point, we are growing to the point where it's common to get 10k plus requests in an hour and I think I can better serve our clients by giving them a 3xx HTTP response with a url for the image that is closer to them served by a dedicated CDN rather than our application server.

Which code is best? I think either 302, 303, or 307 are the available choices. Keep in mind that this media has no SEO value and my sole concern is delivering the static image to the client as fast as possible without causing problems with old mail clie开发者_开发问答nts.

http://en.wikipedia.org/wiki/List_of_HTTP_status_codes


The 302 status code would be your best bet if http 1.0 clients are in the potential mix. Using a 302, future requests should be made to the original URL (e.g. so you can continue to track it, compared to a 301 which would suggest future requests go to the new URL). 303 is typically used for POST requests. 307 may have some issues with http 1.0 clients.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜