News for hackers. Stuff that matters.
Re:How to save $13.27 on your SaaS bill by umvi on Monday July 29, 2024 @10:12PM (#41105516)
If you are only serving static content, it's hard to beat GitHub pages.
Re:How to save $13.27 on your SaaS bill by oefrha on Monday July 29, 2024 @11:34PM (#41105846)
GitHub Pages is pretty bad for static content with its universal

  Cache-Control: max-age=600
that can’t be changed. Your assets should have much longer expiry and hopefully be immutable. Just get a server, it’s cheap and you can do proper cache control and you’re not beholden to your Microsoft overlord.
Re:How to save $13.27 on your SaaS bill by tverbeure on Tuesday July 30, 2024 @12:23AM (#41106030)
What does that matter?
Re:How to save $13.27 on your SaaS bill by oefrha on Tuesday July 30, 2024 @12:53AM (#41106145)
With long expiry/immutable assets, only the HTML needs to be refetched from the server on refreshes or subsequent visits, instead of everything after merely ten minutes. On slow and/or high latency networks the difference can be huge. And you don’t even need to intentionally refresh — mobile browsers have been evicting background tabs since the dawn of time, and Chrome brought this behavior to desktop a while ago to save RAM (on by default).
Re:How to save $13.27 on your SaaS bill by adriancr on Tuesday July 30, 2024 @01:58AM (#41106401)
But they are not refetched if etag is used properly: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ET...

Most you have is some HEAD requests.

Re:How to save $13.27 on your SaaS bill by oefrha on Tuesday July 30, 2024 @03:04AM (#41106732)
By refetch I mean re-requested, which can return 304 responses. You still have to do a roundtrip for each resource in that case, and many websites (including static ones) have this waterfall of requests where html includes scripts and scripts include other scripts, especially now that some geniuses are pushing adoption of native esm imports instead of bundling. The roundtrips add up, and good luck if your link is unreliable in addition to being high latency. Compare that to proper caching where a refresh doesn’t request anything except maybe the html. I have experienced the web on such a link and it’s a shitshow.
Re:How to save $13.27 on your SaaS bill by adriancr on Wednesday July 31, 2024 @12:42PM (#41120788)
Seems like a problem with the websites and not the cache expiry.

I have also experienced this, during dial up period, I agree its not pretty and most dont even consider it.

Re:How to save $13.27 on your SaaS bill by tverbeure on Tuesday July 30, 2024 @01:07AM (#41106184)
Ok. I don't think this is a big deal for the vast majority of blogs, like mine, that are hosted on GH pages. It's just HTML and some photos that are unique per post. But I also don't see why GH would put the number so low.
Re:How to save $13.27 on your SaaS bill by oefrha on Tuesday July 30, 2024 @01:24AM (#41106248)
Because they have this one max-time for everything, from things that should be refetched frequently (html, unversioned scripts and stylesheets, etc.) to things that should be immutable (versioned scripts and stylesheets, images, etc.). They don’t understand your website. You do, and you can set exactly the right headers for the best user experience. Btw you can set the right headers with Netlify and Vercel as well.
Re:How to save $13.27 on your SaaS bill by pfg_ on Tuesday July 30, 2024 @01:14AM (#41106218)
Presumably so that when it shows the checkmark and says your website was updated you don't go there and wonder why it hasn't updated for you
Re:How to save $13.27 on your SaaS bill by mertysn on Tuesday July 30, 2024 @03:52AM (#41106969)
Is there a workaround to this within the realm of GitHub Pages? My initial search concludes: without GitHub allowing custom headers, no
Re:How to save $13.27 on your SaaS bill by umvi on Tuesday July 30, 2024 @01:59PM (#41112206)
I'm not confident a "cheap server" (like a $5/mo DO droplet) would be able to withstand being on the front page of HN, but I am pretty confident a GH pages page could withstand being on the front page of HN.
Re:How to save $13.27 on your SaaS bill by skrause on Tuesday July 30, 2024 @05:30PM (#41114336)
I had a blog article of mine on the HN front page a few years ago and the nginx serving static pages from an ultra cheap VPS didn't even break a sweat.
Re:How to save $13.27 on your SaaS bill by jacoblambda on Monday July 29, 2024 @11:50PM (#41105912)
Or cloudflare pages. As far as I can tell static content is served at no cost and dynamic requests have very generous free limits (something like 100k requests/day)
Re:How to save $13.27 on your SaaS bill by rustystump on Monday July 29, 2024 @11:05PM (#41105725)
i love gp. this one almost didn't fit on it because I wanted to serve a small db file to the client rather pay for remote. Luckily I was able to keep it under their pretty generous file limit.

https://github.com/dgerrells/liftme

https://dgerrells.github.io/liftme/

Re:How to save $13.27 on your SaaS bill by weitendorf on Tuesday July 30, 2024 @12:49AM (#41106121)
Cloudflare pages is better overall because it’s trivially easy to integrate with DNS for your custom domain/cloudflare workers, and handles staged changes better IMO. You can point it at a GitHub repo so unless you have a complex build it’s easy to setup.

Unfortunately IME it’s not a super well-polished product though (I can’t for the life of me get their CLI “wrangler” to login to a headless machine, and their HTTP APIs are not documented well enough to use for non-git file sources, so I can’t get it to work in my not-so-special dev environment setup). So it’s only better if you can get it to work, although that’s something you’ll probably figure out in the first 5-10m of using it.

Re:How to save $13.27 on your SaaS bill by wordofx on Tuesday July 30, 2024 @04:16AM (#41107101)
You can use custom domains on github. Wouldn’t go near cloudflare.
Re:How to save $13.27 on your SaaS bill by lou_cypher on Wednesday July 31, 2024 @05:04PM (#41123447)
Why?
Re:How to save $13.27 on your SaaS bill by vasco on Tuesday July 30, 2024 @02:32AM (#41106550)
But cloudflare has a growing monopoly on internet traffic that is worse for the internet than privacy busting laws that are passed. If you are a technologist worried about the distributed nature of the web, you should avoid it.
Re:How to save $13.27 on your SaaS bill by yencabulator on Wednesday July 31, 2024 @09:57PM (#41125525)
As opposed to Microsoft...
Re:How to save $13.27 on your SaaS bill by arp242 on Tuesday July 30, 2024 @08:44AM (#41108564)
The main downside of GitHub pages is that they don't support running your own Jekyll plugins from _plugins; sometimes it's just a lot easier to write a bit of Ruby code. That said, you can just generate stuff locally and push the result, but that's the main reason I've been using Netlify.
Re:How to save $13.27 on your SaaS bill by umvi on Tuesday July 30, 2024 @08:54AM (#41108642)
Can't you do pretty much anything in GitHub actions?
Re:How to save $13.27 on your SaaS bill by arp242 on Tuesday July 30, 2024 @01:53PM (#41112129)
You mean run Jekyll and deploy "manually"? That should work, yeah; didn't think of that actually. But the standard "GitHub Pages" deploy won't work with custom Ruby.