Live data from Hacker News

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

github.com

61–70 of 182 posts

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

#61

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…

How come I couldn’t find your service when I was looking for alternatives for bitly? The only results I got via Google, product hunt ... services that were overpriced and very limiting (nr of teammates)

Also on PH by the way https://www.producthunt.com/posts/blanq/. Will bump you up as paid account for free if you are interested :)

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

#62

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.

> Your browser should, though

It should, in the right circumstances. By default, CORS dictates that cross-origin requests should not be allowed.

But sometimes you want that to be possible, so we have headers available to is where we can signal which domains are allowed to access the origin when on another origin.

In the case of the GitHub API, they (GitHub) are setting these headers to allow any origin to access the GitHub API from any other origin, that's why your browser doesn't throw a security error. Check out the various "access-control-*" headers the GitHub API returns as response headers when you use it.

It has nothing to do with custom domains or GitHub Pages, but all to do with CORS and associated headers. You can learn more about CORS here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

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

#63

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.

The Github API has CORS setup to allow requests from everywhere. This has nothing to do with being hosted on GitHub Pages.

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

#64

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.

Just a CORS header.

Access-Control-Allow-Origin: star

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

#65
post #63

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.

The Github API has CORS setup to allow requests from everywhere. This has nothing to do with being hosted on GitHub Pages.

> Github API has CORS setup

I know perfectly fine what you mean here, but in the name of security, it's important to be precise.

All websites and browsers have CORS, one way or another, as CORS is the general concept. By default, only "same-origin" requests are allowed and "cross-origin" requests are disabled. But CORS is still there none the less.

What GitHub has done in this case, is add support for "cross-origin" requests.

Nitpicky maybe, but thought it'd be useful to add to avoid any confusion.

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

#66

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…

I think the example on your home page would look better as https://mysto.re/buy-shoes

https://en.wikipedia.org/wiki/.re

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

#67
post #62

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.

> Your browser should, though It should, in the right circumstances. By default, CORS dictates that cross-origin requests should not be allowed. But sometimes you want that to be possible, so we have headers available to is where we can signal which domains are allowed to access the origin when on another origin. In the case of the GitHub API, they (GitHub) are setting these headers to allow any origin to access the…

Ah, thanks. I thought they might've had a dynamic list of domains that they add each custom domain too; I guess that would be enormous, even if it sounds a lot more secure than "Access-Control-Allow-Origin: *"!

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

#68
post #66

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…

I think the example on your home page would look better as https://mysto.re/buy-shoes https://en.wikipedia.org/wiki/.re

Wow! Thanks. That's way better.

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

#69

Somebody was faster than me https://github.com/nelsontky/gh-pages-url-shortener/issues/1...

That's a good one fixing now hehe

thank you for this project. Great idea of how to "hack" around GH. Hope it can be used as inspirations for similar projects!

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

#70

> Unlike many URL shorteners, this one does not need a database and can be entirely hosted on GitHub pages. it does need a database though. it just uses someone else's database

Just like serverless still has servers, this can be reasonably called dbless :)
Post reply on HN