Live data from Hacker News

Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

github.com

51–60 of 182 posts

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#51
post #4

Earlier quoted context omitted.

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…

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 lo…

How about making it turing complete?

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#52

3425 lines in package-lock.json for a "Minimal URL shortener" https://github.com/nelsontky/gh-pages-url-shortener/blob/mai...

And all that is just for being able to write `response = await fetch(...)` instead of `fetch(...).then(...)`.

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#54

Since I am running a URL shortener service https://blanq.io , my two cents: 1. I looked at https://github.com/nelsontky/gh-pages-url-shortener/blob/mai... and it is a basic script that does nothing more than redirection. A lot of URL shorteners on the web do a lot more. Premium ones can track users and route links based on client. 2. Most of URL shortening audience is non-technical and they usually like to pay and fo…

Yes I agree with all of the above. And with my fixation on URL shorteners, I did have a dream of creating a full fledged URL shortening service like yours. I wasn't technically skilled enough for that then and thus didn't do it but your site does look great!

Thanks. I started this since it had a low-entry barrier but, going from basic to a mature product was quite challenging and a great learning experience personally.

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#56

Earlier quoted context omitted.

The github api does not care about your origin so that wasn't something I had to deal with! If I had to deal with something like that, my best option would be to use a proxy server, which would arguably negate the whole point of this "serverless" hack.

Your browser should, though. I would expect the fetch() request from nlsn.cf to github.com to throw a security error — presumably, the way custom domains are handled on github pages includes the addition of the custom domain as a trusted source at the github end.

What I meant was that GitHub's API does not check for the Host header, and the API allows connections from any source. Thus, CORS isn't an issue at all.

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#58
post #6

It's so cool. I am using https://git.io as url shortener, and now this project makes me reconsider. What if some of shortener domain so popular that Github takes some action? Like block or ban?

This is definitely just a fun hack and not meant for production! For production ready short links with low overheads I would personally recommend using Firebase URLs or cloud firestore.

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#59

Earlier quoted context omitted.

Your browser should, though. I would expect the fetch() request from nlsn.cf to github.com to throw a security error — presumably, the way custom domains are handled on github pages includes the addition of the custom domain as a trusted source at the github end.

What I meant was that GitHub's API does not check for the Host header, and the API allows connections from any source. Thus, CORS isn't an issue at all.

But the same-origin policy implemented by your browser should prevent the request before it gets anywhere near the API.

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#60

Interesting. This could be considered as abuse of github issues though.

The best hack on github issues I know is the trending-repos repo. Just subscribe to the issue of the technologies you care and you'll receive a daily/weekly email with the most starred repos for that period:

https://github.com/vitalets/github-trending-repos/

Post reply on HN