使用 URL 缩短服务

发布于 2024-08-26 19:11:41 字数 418 浏览 6 评论 0 原文

我正在尝试在我的应用程序中使用 URL 缩短服务。但是,我想公开我的自定义tinyURL 域而不是其中一项服务。为此,我做了以下操作:

  1. 我从标准的tinyURL服务缩短了我的长URL,并获得了一个缩短的URL,例如 - http://tinyurl.com/abcdXYZ

  2. 我将网址公开为 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:

  1. I shorten my long URLS from a stardard tinyURL service and get a shortened URL like - http://tinyurl.com/abcdXYZ

  2. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

谜泪 2024-09-02 19:11:41

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 the kk.ly hostname rather than tinyurl.com. I do not know if the HTTP server at tinyurl.com will take offense. Also, the people managing tinyurl.com may themselves feel offended (basically, you are using their service without keeping their name in the URL). I suggest that you check beforehand.

你的笑 2024-09-02 19:11:41

仅仅因为您可以设置 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/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文