12 ms·
Cloudflare Pages: Best server tech since CGI-bin?
- Cthulhu_ 4y agoTitle has been editorialized; there is no question mark in the original, and the capitalization is different. As people smarter than me have said, if a video or in this case article asks a question, the answer is usually "no".
- musicale 4y agoI wonder why the article (or glek.net in general?) takes so long to load.
- quickthrower2 4y agoYou must be a long way from the edge :-)
- pid-1 4y agowishlist: static page hosting for internal pages (e.g behind IP allowlists, SSO, etc...)
- 9dev 4y agoThat is integrated in Pages, it offers to set that up using Cloudflare Access. Fulfills your wishlist, and more. (Not affiliated)
- truthwhisperer 4y ago
- gkoberger 4y agoI feel like there's a large class of tools in this space now (Vercel, Netlify) that do all of this and more, and this post is less about Cloudflare Pages and more about the (really good) state of static hosting these days? One thing that stuck out was the comment about "Twitter cards", since Vercel/Next now has this built in: https://twitter.com/vercel/status/1579561293069316096 https://twitter.com/vercel/status/1579561293069316096
- elondaits 4y agoI’m happily using CloudFlare pages. The reason I haven’t tried Netlify is that after the free tier everything seems a little overpriced. I didn’t go for Vercel because I don’t want to use Next.js and I’m afraid I’ll run across some limitation because of this. I was already using Cloudflare as a CDN for S3 and GitHub pages, and their offerings seem to be growing quickly and wanting to compete with Amazon rather than the static hosting companies.
- jokethrowaway 4y agoVercel is pretty good as a generic static hosting. I run a handful of next.js, solid.js or vanilla html websites. Can't think of anything next.js specific you miss out on, you can just configure anything in a vercel.json file.
- leerob 4y agoAll of the Vercel platform features you can use in Next.js (or other frameworks) are also available through the Build Output API for frameworks to target. This is what frameworks like SvelteKit, Nuxt, Solid, etc use on Vercel. https://vercel.com/blog/build-output-api https://vercel.com/blog/build-output-api
- emptysongglass 4y agoIf you don't want to deal with any of that but like MDX (think Markdown with the option of JavaScript), I believe motif.land publishes your MDX sites with Vercel.
- cj 4y agoStatic hosting combined with server-side dynamic content modification using postgres was the interesting part for me. Static hosting has historically been seen as exactly that, static and immutable. Things like Cloudflare functions/workers can turn static hosting into dynamic content delivery while maintaining (most of) the benefits of static hosting. Granted, this can be done whether the underlying content is hosted on Cloudflare, AWS, or a server in your garage so long as it’s proxied/CDN’d by a service like Cloudflare or Cloudfront+Lambda@edge, etc.
- untitaker_ 4y agoWhat is really annoying is that Cloudflare pages will strip the file extension off of your html pages, and perform permanent redirects to those new URLs. Now if you're intending on moving to a new hosting service that doesn't do that (cgi-bin), all Google search results to your site will 404. Github pages and likely others also supports this format, so moving between those two services doesn't exhibit this problem. Moving to cgi-bin will. I'd suggest Cloudflare shouldn't try to establish their scheme as canonical url and rather implement github pages behavior, but what do I know... I'm just hosting an old fashioned blog, not a JAMstack/SPA/whatever thing
- kc10 4y agoI exactly ran into this issue when migrating from a different provider to CF pages. I preferred to strip away the .html extensions anyway, so it was okay in my case. CF should trigger a HTTP 308 for older .html to the new urls automatically.
- sofixa 4y agoHaving .html file extensions is very old school, and its removal is one of the popular/default redirects on all http servers that support it. Site generators also hide it through various methods (e.g. having a folder with the path name with just an index.html where a dynamic redirect isn't possible).
- superkuh 4y agoYes. New school's defining feature is needless layering of complexity to hide the simple truth of the file system from users.
- neilalexander 4y agoIs there a reason why someone visiting your website should know or care about file extensions?
- lenkite 4y ago
- dixie_land 4y agoHaving worked with some J2EE early in my career, I also had trouble mentally mapping "middleware" to an "interceptor" function when first encountering these "hip" frameworks
- harwoodjp 4y agoCloudflare Pages and Workers (and similar products) are indeed great but I recently switched over to a plain old free tier Oracle Cloud VM with FastAPI behind Nginx (Docker containers). I use Cloudflare as a proxy for HTTPS/certs. I don't have to think about Cloudflare Worker limitations, can host a Postgres instance, and simply deploy through `git pull` and `docker-compose up`.
- alphabettsy 4y agoUsing Fly.io myself, behind Cloudflare. Free container hosting and free Postgres instance both big enough for my needs.
- svnpenn 4y agoFly.io is weird about overages: https://github.com/superfly/docs/issues/382 https://github.com/superfly/docs/issues/382
- jprd 4y agoBut now Oracle has your financial information. I would rather give my Social Security number to a Nigerian prince. There's a reason Larry Ellison owns an entire Hawaiian island, and it ain't nothin' nice...it ain't nothin' nice (#QTip)
- andrewstuart 4y agoIt's tempting to use the Oracle free instance but I wouldn't use it for production cause I don't trust it will be free in the long term.
- Comevius 4y agoThe rest of the industry haven't even started figuring out what Cloudflare Pages Functions + Durable Objects can do. Workers can also send emails for free, and soon you will be able to process them as well with Email Workers. Cloudflare also doesn't charge you for egress either.
- quickthrower2 4y agoWeary of free as in beer. Often it is better to pay, for a situation where you are the actual customer.
- Comevius 4y agoThey made emails and egress free because there is a lot of price gouging going on in the industry that stops people from starting businesses. https://blog.cloudflare.com/aws-egregious-egress/ https://blog.cloudflare.com/aws-egregious-egress/ Identity as service is another category that's egregiously priced, and it's usually priced based on monthly active users too, which is the worst. It would be great to see Cloudflare disrupting that one as well.
- kkielhofner 4y agoThis. At this point in everything being "cloud native" fewer and fewer people and orgs have any experience building internet networks - buying transit (circuits), peering, etc. For players at Cloudflare, AWS, GCP, etc scale it's essentially free. The fact that many of them (other than Cloudflare) charge $0.08/GB or whatever for egress and that's just accepted because people think "that's what it costs" is wild to me. My personal conspiracy theory of sorts is that many compute, storage, etc products from big cloud providers are essentially priced as loss leaders because while the average dev has some idea of what a GB of storage, GHz CPU, etc costs (because they priced a laptop) they have no idea how bandwidth and connectivity is priced at this level and cloud providers capitalize on that (somewhat understandable) ignorance.
- quickthrower2 4y ago
- jacooper 4y agoI am waiting for the time where we can host WordPress freely with static hosting and workers for admin ui/dynamic content. Otherwise static websites are only for devs.
- sofixa 4y agoI've successfully run WordPress with the simply-static plugin, and a script to send to static hosting. WP run on an arm64 instance that was only started when editing was needed. Besides WP, there are static CMSes that fit a modern workflow perfectly.
- fariszr 4y ago> I've successfully run WordPress with the simply-static plugin, and a script to send to static hosting. Interesting, simply-static never worked for me, only wp2static did and it had a lot of bugs. > WP run on an arm64 instance that was only started when editing was needed. How do you do this?, are you doing some kind of webserver container run trigger? Or running it on a managed platform? > Besides WP, there are static CMSes that fit a modern workflow perfectly. Yeah but they aren't so customizable and flexible like WordPress, the goal is to be able to create a whole static site without needing to write anything manually.
- metadat 4y agoYeah, I have a few WordPress sites that would be great to move to SQLite (durable objects) / workers+functions. My sense is it's still a ways out from being practical, though.
- colesantiago 4y agoThis. I keep seeing these 'JAMstack' sites are the new hot thing when a static wordpress site is enough and easier to update than 'JAMstack' sites, in reality these sites are just glorified HTML under a CDN. I don't see the benefit of JAMstack when you can just place a static WP site under a CDN like Cloudflare and have all the benefits of WP and a CMS to edit content. At least with Cloudflare they are more than just a CDN, others like Netlify and Vercel seem to be both over engineered and overpriced for what they do.
- jasonhansel 4y agoWhy not just make it CGI (or FastCGI) compatible so you can test it locally or run it in other environments? At least for things that are actually generating responses rather than acting as middleware. Oh, right, vendor lock-in.
- pjkundert 4y agoYou can run workerd locally.
- solardev 4y agoYou can pretty easily change from Cloudflare to any other Jamstack host. Cgi just isn't necessary anymore and would be more baggage than anything at this point. The old web stacks are just time sinks. It's so much nicer to be able to git push... And that's it. Done.
- alehlopeh 4y agoForgive my digression but for years I’ve seen small efforts here and there to elevate the concept of a “stack” and promote it as the level abstraction to use when discussing web apps and the like. What’s up with that? Grab any 3 commonly used pieces of technology whose names can be used to form a fun initialism, append stack to the end, and soon there will be experts speaking at conferences dedicated to it. JamStack is an example you mentioned. I’ve heard others over the years. I disagree that it’s a useful unit of thought. No one I know or work with ever talks about “web stacks” this way. Am I missing something here? Is this just some kind of niche? Who’s marketing these?
- megous 4y agoIt's been around since forever. Things like LAMP (Linux Apache MySQL PHP), etc.
- ameliaquining 4y agoJamstack in particular is not really an example of that; it is more of a kind of architecture than a specific stack, in that it doesn't prescribe the use of specific software. An architecture where all the HTML/CSS/JS is precompiled statically for maximum cacheability, and server-side dynamic behavior happens exclusively within AJAX calls that return structured data, is a natural kind, and useful to have a term for so that we can compare and contrast it to other ways of building web apps. More broadly, other acronym stacks are a thing because complementary technologies cluster together, especially in relatively immature ecosystems. E.g., PHP traditionally had better support for mySQL than for competing databases, so if you were building an app in PHP, you probably used mySQL for data storage. These effects may have weakened over time as the graph of ecosystem integrations has grown more complete (and indeed I feel like I hear less about acronym stacks these days than I did half a decade ago), but I don't think they've died out entirely.
- sramam 4y agoa bit off-topic, but couldn't resist: > As a shortcut, I used GPT-3 to generate a basic typescript function for me. This let me look at TS type definitions and get a better idea of what’s available so I could get developing. As a long time programmer, I keep trying to maintain my skepticism of AI/ML techniques for program authoring. Comments like this are dissolving my objections by the minute...
- tarasglek 4y agoSee my comment re GPT above. It has saved me quite a few hours since I started using it.
- mceachen 4y agoI don't know which GPT-3 tooling they were using, but Github Copilot can be _exceptional_ at generating rubbish. Autocomplete, at least for me, was seldom even syntactically correct, and never semantically correct.
- rs_rs_rs_rs_rs 4y agoI like Pages, I hope they'll support hosting multiple projects from different branches of a repo at some point...
- Walshy 4y agoWe will :)
- ArtWomb 4y agoReminder: Cloudflare's "Worker's Launchpad" application for inaugural cohort approaches https://www.cloudflare.com/press-releases/2022/1-billion-workers-launchpad-funding/ https://www.cloudflare.com/press-releases/2022/1-billion-wor... Recent thread on Learning Blender 3D has me thinking that a kind of "Blender Mentor" exchange with live zoom critiques & happy hour may be fun ;) https://news.ycombinator.com/item?id=33273022 https://news.ycombinator.com/item?id=33273022
- EarlKing 4y ago
- pantojax45 4y agoHow does using GPT-3 make the types more visible? Feels futuristic but also incomprehensible to me. > As a shortcut, I used GPT-3 to generate a basic typescript function for me. This let me look at TS type definitions and get a better idea of what’s available so I could get developing.
- lelandfe 4y agoHope the author responds, because that stuck out to me too! My assumption was that their prompt was something like "typescript cloudflare function" and they just used the resultant code to see types in action inside their IDE.
- wilg 4y agoGitHub Copilot is GPT-3 under the hood, so maybe that way?
- tarasglek 4y agoI use copilot, but not for this. I find raw gpt-3 conversational interface to be much more useful for getting over various small programming puzzles.
- Filligree 4y agoPrompted correctly, I find that Copilot can do pretty much everything GPT-3 can except generating long-form prose. You're probably right that it's more flexible, but then again I don't want to constantly switch out of IDEA.
- tarasglek 4y agoI think we need work in conversational interfaces into IDEs. Tab-completion is insufficient
- tarasglek 4y ago
- ianbutler 4y agoSide note: As someone who wanted a high level overview of Durable Objects, the Cloudflare announcement page 404s https://blog.cloudflare.com/introducing-workers-durable-objects/ https://blog.cloudflare.com/introducing-workers-durable-obje...
- kentonv 4y agoThanks for catching this. Not sure what happened exactly but jiggling the handle (republishing the post) seems to have fixed it.
- ianbutler 4y agoYup, and thank you for fixing it!
- quickthrower2 4y agoThis sounds magical: > Durable Objects make this easy. Not only do they make it easy to assign a coordination point, but Cloudflare will automatically create the coordinator close to the users using it and migrate it as needed, minimizing latency.
- strix_varius 4y agoIt sounds magical. I would recommend trying it first... the experience of trying to actually build anything with it is quite un-magical. The documentation, CLI, workflow, and pricing (for sockets especially) all fall quite short.
- quickthrower2 4y agoI agree. I have learned as a general idea "use the fancy new thing if the pain of not using it is costing you a lot of money", because having your data nice and structured, typechecked in a relation DB with a query engine is the sweet spot for most applications. Firebase taught me this lesson. If you have an app with user ids and user profiles, and another records (plural) references them, you need a join, and non-relation databases suck at joining data. Having data flung about the place in these objects sounds a bit scary (how do I back them up, and keep track of them, how do I join data from multiple objects, and what if those different objects are all around the world).
- threatofrain 4y agoThe Cloudflare cloud experience is "being sold short by subpar documentation" right now because important elements of their ecosystem are being ramped up from beta status. They also have internal docs which aren't kept up to date with their actual product. I'd check back in a few months because their beta experience can be very touch-and-go.
- cxr 4y ago> The Cloudflare cloud experience is "being sold short by subpar documentation" right now because important elements of their ecosystem are being ramped up Their docs are subpar because Cloudflare is just not interested enough in documentation improvements and is hostile to the people who are interested and who try to make the improvements. I tried fixing a 404 in their docs once. This would have taken, you know, approximately 2 seconds with a real wiki or CMS[1]. What resulted instead was an excruciating back-and-forth that took 9 messages over a span of exactly 5 hours, ended in no fix, and a Cloudflare dev trying to "upperhand" me (in the vein of George Constanza's pre-emptive breakup—"I'm afraid that I am gonna have to break up with you"[2]). Sure, Cloudflare team, there's nothing wrong, I guess, with choosing to believe in the delusion that a repo full of Markdown files and the GitHub generation's busted-ass PR-based edit workflow is an acceptable substitute, just like there's nothing wrong with writing your name with a pencil that has a brick taped to it[3]. 1. <https://groups.google.com/g/mozilla.dev.mdc/c/BU09C48bmGU https://groups.google.com/g/mozilla.dev.mdc/c/BU09C48bmGU> 2. <https://www.youtube.com/watch?v=0aIG2EJzE4o https://www.youtube.com/watch?v=0aIG2EJzE4o> 3. <https://gordonbrander.com/pattern/brick-pencil/ https://gordonbrander.com/pattern/brick-pencil/>
- Leftb 4y agoAgreed. One area where it's maybe not sold short but just hurting the UX; it's not immediately clear from their documentation that certain NextJS features you get 'automatically' on Netlify/Vercel just aren't supported yet. For example, using any kind of dynamic routing (i.e. going to `/books/:id` directly rather than clicking through) doesn't work yet as there's no router available to tackle this for you. According to their Discord, it's in the works but it has been in that state for a few months already. You can work around this with some Workers that capture the dynamic routes, request the nextjs html file and return that, but then you're using up your Functions quota as well.
- iot_devs 4y agoThose function don't suffer from cold start time? When somebody hit my webserver for the first time, how long are they gonna wait for the page to be loaded? Assuming a noop in the functions part.
- tyingq 4y agoIt uses clouflare workers, which is just spinning up v8 isolates, so there's no VM booting up. It's fast. They are also edge located. There are scenarios where using the kv or durable objects can cause a round trip back to the mothership, but not for reads. https://developers.cloudflare.com/workers/learning/how-workers-works/ https://developers.cloudflare.com/workers/learning/how-worke...
- Havoc 4y agoCold start is basically zero
- iot_devs 4y agoI don't understand how... I can understand almost zero time to start a worker, but how do they move the code?
- andrewstuart 4y agoI tend to agree. Cloudflare services are awesome. Their documentation tends to be OK but thin. Certainly not great.
- Walshy 4y agoWe're working on the documentation, I agree it can certainly be thin (or just not understandable). Please do file an issue for any improvements you'd like to see: https://github.com/cloudflare/cloudflare-docs/issues https://github.com/cloudflare/cloudflare-docs/issues
- andrewstuart 4y agoI like documentation with lots of complete examples of every option. Reference guides with every object/function/method documented. Links to sample code on github.
- ZephyrBlu 4y agoFor Workers I've found that their docs are anything but thin. Extremely comprehensive and very helpful.
- schwartzworld 4y ago> As a shortcut, I used GPT-3 to generate a basic typescript function for me. I'd love to see a more detailed post about that. I don't know any TS devs using that kind of workflow.
- Filligree 4y agoTo write functioning code, you need to know how to write functioning code. The biggest issue with Copilot is that, to use it well, you need to know: - How to write functioning code. - How to quickly review other people's code for correctness. - How to write good comments. - How to tweak the ordering in which you write code such that it's easier for Copilot to understand. - How Copilot and other GANs work, in general. An awareness that Copilot is built on GPT-3, familiarity with what that implies, and so on. And if you don't, that results in the AI seemingly not working as well, which makes it easy to make the assumption that it isn't an incredibly useful tool. It is, it just has a learning curve measured in weeks. I believe this is why we constantly have arguments on whether or not it's helpful.
- tarasglek 4y agoYes, the copilot UX is extremely detrimental to reputation of AI systems for coding. I think we need some UX work to better explain possibilities and limitations and programming will never be the same
- deleted 4y ago[deleted]
- hackyhacky 4y agoPotentially stupid question: how is this different from hosting a static site on S3 and using CloudFront as a CDN? Assuming I don't need server-side JS, I don't see the benefit.
- donmcronald 4y agoIMHO, when I use AWS I feel like I spend a lot of time dealing with the infrastructure. For example, you have to create the bucket, add IAM users that can deploy to it, set up CI that can do that deploy, configure CloudFront, etc.. With CloudFlare Pages you click a couple buttons in the UI and push to GitHub. When I tested it, I didn't get bogged down managing infrastructure which I've always struggled with (overthinking) in the past. I was almost instantly writing code that solves my problem(s). The advantages aren't as huge with a purely static site, but they're still there IMO.
- superdug 4y agoIf you use a static site generator and it's in gitops, you can drop all of the considerations of AWS and focus on one control panel inside of Cloudflare and the content of your page. That's the benefit.
- johnebgd 4y agoCloudflare continues to add capabilities to their free tier to attract users. Meanwhile, Netlify just ejected all of the free plan users who work off GitHub.
- jaza 4y ago> Netlify just ejected all of the free plan users who work off GitHub. First I've heard of such news. What does that mean? Link please?
- londons_explore 4y agoIn 10 years time when cloudflare goes bankrupt/withdraws the free offering, will you be able to redeploy to another platform or will you start having to delve into 10 year old code and porting it to a new API? Is there at least an nginx-cloudflare module that lets you self-host this stuff?
- ezfe 4y agoThe static part, certainly (aside from issues like .html redirects, etc.). The dynamic part, hopefully with minimal work assume you can find a service that offers the same features, plugging into a new interface shouldn't be difficult.
- rozenmd 4y agoYou can self host the entire Worker runtime if you'd like: https://github.com/cloudflare/workerd https://github.com/cloudflare/workerd
- Comevius 4y agoYou mostly use standard Web APIs inside Workers, so that's portable, but the entire runtime (including Durable Objects, KV, R2 and D2) is open-source and can be self-hosted. https://blog.cloudflare.com/workerd-open-source-workers-runtime/ https://blog.cloudflare.com/workerd-open-source-workers-runt...
- cft 4y ago
- z7 4y ago
- somishere 4y agoBiggest advantage I find is pre-scoped request-level control over everything. When someone loads your page, every single asset request hits your worker. It's both extremely simple and exceptionally powerful. Choose which responses to modify, authenticate, proxy, redirect, or let through. All in a single file with a few dozen LOC. No complex pre-app devops, middleware or routing policies required (i.e. oh sorry that route is proxied by a lambda, or you should check the cloudflare dash there's a worker sitting in front of that). Yes, there are a bunch of limitations - but in practice I quite appreciate the boundaries and the reasoning. There's also the portability question, but we're talking about PaaS. As someone who was using Firebase for many years, and static AWS + lambda prior to that I find this evolution entirely refreshing. I've pushed 5 personal projects on pages since Jan and working on more. Most recently https://thesom.au/gh/cvms https://thesom.au/gh/cvms
- tarasglek 4y agoAuthor here, went through your github. Cloudflare should post your code as reference architecture. Answered so many questions re proper app structure on CF. Really appreciate the amount of effort your examples will save me in future.
- somishere 4y agoThanks for the kind words - though not certain too many would share your enthusiasm! Good luck with the tinkering.
- superdug 4y agoI'm curious about cams, but I'm being greeted with "Your passphrase has expired" when I try to get it to "let me in"
- somishere 4y agoThanks for the heads up. There's nothing mind blowing on the demo page, but password has been unexpired if you still want to take a look.
- Havoc 4y agoCF workers currently can’t do anything that requires a socket right?
- kondro 4y agoThey can with Durable Objects, but you'll pay $12.50/million GB-s while each connection is open (which is about $93.75/million minutes). It's currently not very competitive with the likes of AWS API Gateway at $0.25/million minutes.
- jesuspiece 4y agoMeh I prefer Cloudfront
- tambourine_man 4y agoI get that the engine is open source, but CGI-bin is a standard interface while Cloudflare Pages is a service. In practice, no one is running workerd at their VMs, so it seems weird for me to compare the two. Cloudflare Pages is better than [insert your favorite hosting service] would make more sense. Still, very cool tech.
- andirk 4y agoI have been working on servers whether professionally as a software engineer or as a pre-teen making a The Simpsons fan website for a couple decades now. I have never once used that `cgi-bin`, never opened it, and still have no idea wtf it is.
- xenospn 4y agoBack when we used to write CGI using Perl or straight up C.
- broodbucket 4y agoIn my experience it's this thing exclusively used in offensive security training/CTFs. Not really sure what the intended use is, but it sure gets owned a lot
- snorrah 4y agoTaras, please stop using emoji in your headings.
- superdug 4y agoThis page inspired me to actually convert as well. I have just recently been forced out of the AWS free tier and for some reason my insistence on using terraform and preserving a dynamic lockable state was somehow costing me $20 a month in DynamoDB costs. Anyways, the pages import to take an existing git repository with a slew of CMS systems (mine being Hugo) supported, and the ability to just publish it to a custom domain in a series of clicks was actually really simple. I think I dedicated 30 minutes of entire work and just saved ~$20/month because of it.
- aliqot 4y ago
- sebag1507 4y ago[I work at Firebase] Hi folks, I've seen some notable mentions of Firebase in this thread. Last week, during the Firebase Summit we launched preview support for Web Frameworks like NextJS and Angular Universal: https://firebase.google.com/docs/hosting/frameworks-overview https://firebase.google.com/docs/hosting/frameworks-overview Support during this early preview includes the following functionality: - Deploy Web apps comprised of static web content - Deploy Web apps that use pre-rendering / Static Site Generation (SSG) - Deploy Web apps that use server-side Rendering (SSR)—full server rendering on demand Cheers,
- xtat 4y agothis... this is content marketing
- tarasglek 4y agoAuthor here, what do you mean?