使用 URL 缩短服务
我正在尝试在我的应用程序中使用 URL 缩短服务。但是,我想公开我的自定义tinyURL 域而不是其中一项服务。为此,我做了以下操作:
我从标准的tinyURL服务缩短了我的长URL,并获得了一个缩短的URL,例如 - http://tinyurl.com/abcdXYZ
我将网址公开为 http:// kk.ly/abcdXYZ (假设 kk.ly 是我拥有的域名)
我还进行了从 kk.ly 到tinyurl.com 的 CNAME 转发
我想知道是否有这种方法有什么问题吗?以前有人尝试过吗——有什么经验/教训可以分享吗?
谢谢, KK
I am trying to use URL shortening service in my app. However, I want to expose my custom tinyURL domain rather than the one of the services. For this, I've done the following:
I shorten my long URLS from a stardard tinyURL service and get a shortened URL like - http://tinyurl.com/abcdXYZ
I expose the url as http:// kk.ly/abcdXYZ (Assuming kk.ly is the domain that I own)
I also do a CNAME forwarding from kk.ly to tinyurl.com
I wanted to know if there are any gotchas with this approach? Has anybody attempted this before - any experiences/learnings to be shared?
Thanks,
KK
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
CNAME 意味着连接将重定向到
tinyurl.com
,但 HTTP 请求中的 URL 仍将采用kk.ly
主机名,而不是tinyurl。 com
。我不知道tinyurl.com
的 HTTP 服务器会不会生气。此外,管理tinyurl.com
的人自己可能会感到被冒犯(基本上,您在使用他们的服务时没有在 URL 中保留他们的名字)。我建议你提前检查一下。The CNAME means that the connection will be redirected to
tinyurl.com
, but the URL in the HTTP request will sill feature thekk.ly
hostname rather thantinyurl.com
. I do not know if the HTTP server attinyurl.com
will take offense. Also, the people managingtinyurl.com
may themselves feel offended (basically, you are using their service without keeping their name in the URL). I suggest that you check beforehand.仅仅因为您可以设置 cname 并将流量重定向到tinyurl.com,并不意味着他们实际上会满足请求。尝试使用有效的tinyurl.com url并将域名替换为他们的IP地址,您会收到404错误。自定义 cname 可能会产生相同的结果。
Google 的 Short Sites 服务专门支持自定义 cname,但它仅适用于 Google Apps。
http://www.labnol.org/internet/setup -tinyurl-like-redirection-service/8333/
Just 'cause you can setup a cname and redirect traffic to tinyurl.com doesn't mean they'll actually service the requests. Try taking a working tinyurl.com url and replacing the domain name with their IP address and you get a 404 error. A custom cname would probably result in the same.
Google's Short Sites service specifically supports custom cnames, but it is only available for Google Apps.
http://www.labnol.org/internet/setup-tinyurl-like-redirection-service/8333/