News for hackers. Stuff that matters.
Re:Show HN: I created a URL shortener that can be entirely h... by diggan on Monday November 16, 2020 @08:04AM (#25111106)
Looks nice and simple! Bit strange to claim "there is no database" and then add "GitHub issues is the database", maybe add "there is no traditional RDMS/document database needed" or something similar.

You might want to detect infinite loops as well :) https://nlsn.cf/6

Last note, the status code seems to be incorrectly set to 404 instead of any of the redirection status code. If you're hosting it on GitHub pages, I'm not sure you can actually control it. If the status code was correctly set + the Location header, I think all browsers would be able to detect the infinite loop automatically and prevent it.

Re:Show HN: I created a URL shortener that can be entirely h... by nelsontky on Monday November 16, 2020 @08:13AM (#25111201)
HAHA so that was you. That was a good one! Yes and that title is definitely slightly misleading I kinda didn't want it to get so long and wanted that slight clickbait effect.

Yep I actually cannot control the status code at all. Part of what made this a fun and hacky project was the fact that I was actually redirecting to the actual URLs by catching the 404s. So, the only way i could think of catching the infinite loop was to supply the domain. That being said, I do appreciate the feedback and it's always great to learn more!

Re:Show HN: I created a URL shortener that can be entirely h... by diggan on Monday November 16, 2020 @08:16AM (#25111232)
Indeed :)

I think you could catch the infinitive loop client-side as well by comparing what the URL to redirect to is, and comparing it with the current URL. If they are the same, prevent the redirect. Although you would still be able to create loops by using two issues instead. Maybe just comparing the full hostname? If it's nlsn.cf, don't redirect.

Re:Show HN: I created a URL shortener that can be entirely h... by a1369209993 on Monday November 16, 2020 @08:34PM (#25119379)
> Maybe just comparing the full hostname? If it's nlsn.cf, don't redirect.

Doesn't work; eg, make http://someothershorten.er/foo -> http://nlsn.cf/1234 -> http://someothershorten.er/foo.

Re:Show HN: I created a URL shortener that can be entirely h... by alexvoda on Monday November 16, 2020 @08:46AM (#25111522)
How about making it turing complete?
Re:Show HN: I created a URL shortener that can be entirely h... by quyleanh on Monday November 16, 2020 @08:08AM (#25111153)
If you use it personally and you know what you are doing, I think this idea is good. For example I have my own domain and when I share long link to friends, I can use it.

By the way, your feedback is good for author improves. Thank you.