Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Could a URL wrapper service follow a URL through its redirects only wrap the final address?

I'm not a networking expert, but it seems viable enough to me. Shoot out a GET request, wrap the final address with your shortener. Cut out the middlemen.

It's an idea. It might fail at scale. And might not be feasible.



Downside is that if I use an URL shortening service that allows me to change where you are headed after the fact (for example after 1000 hits, go to a new page instead) then you've just broken that functionality.


That's no longer a URL shortening service, that's a campaign redirection service. Just serve the appropriate content, rather than relying on redirects.


Except that my actual URL is much longer than the short one that I am using on Twitter, advertisements, T-Shirts and various other sources.

Directly serving the content while possible is not what my client wants. They want to go from their short URL to the longer full domain one.


A lot of shorteners don't just use regular HTTP redirects, they use Javascript or meta tags. To find the actual destination, the server would at the very least have to detect and parse HTML, and maybe even execute Javascript.


Yes, you do a HEAD request, and follow the redirects till you stop getting redirected.

We do this to catch certain spam urls.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: