用于跟踪图像URL的HTTP 302,303或307 [英] HTTP 302, 303 or 307 for tracking image url

查看:129
本文介绍了用于跟踪图像URL的HTTP 302,303或307的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试跟踪我们发送的特定电子邮件是否已打开,因此在我发送的每封电子邮件中使用散列网址来显示图像。目前,当请求该URL时,我记录了电子邮件已被查看的事实(基于URL中的哈希)并从Web应用程序服务器提供图像(对于每个人来说都是相同的图像)。

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).

此时,我们正在发展到一小时内获得10k以上请求的常见现象,我认为通过为网址提供3xx HTTP响应,我可以更好地为客户服务对于靠近它们的图像,由专用CDN而不是我们的应用程序服务器提供服务。

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.

哪个代码最好?我认为302,303或307是可用的选择。请记住,此媒体没有SEO价值,我唯一担心的是尽快向客户端提供静态图像,而不会导致旧邮件客户端出现问题。

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 clients.

< a href =http://en.wikipedia.org/wiki/List_of_HTTP_status_codes =nofollow> http://en.wikipedia.org/wiki/List_of_HTTP_status_codes

推荐答案

302状态代码将是您最好的选择。使用302,将来的请求应该对原始URL进行(例如,因此您可以继续跟踪它,相比之下301表示将来的请求转到新URL)。 303通常用于POST请求。 307 http 1.0客户端可能存在一些问题。

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.

这篇关于用于跟踪图像URL的HTTP 302,303或307的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆