Live data from Hacker News

You can serve static data over HTTP

ignore.pl

51–60 of 127 posts

Re: You can serve static data over HTTP

#52
This is great advice and its most of the time everything you need for a personal website.

A generation that grew up with Wordpress et al. will have dificulties getting that really all there is to a website is some html. I switched from a Spring Boot web app that used Thymeleaf for the templating engine, with a MySQL db on a Linux vps and Heroku (I did it to learn/practice) to a Hugo blog that I publish locally then scp to a VPS with Caddy setup to serve the static content. Nothing to hack/maintain/worry about.

As an extra point I would even complete the suggestion with adding direct HTTP not S, support. Your page will load even faster and you're transmitting some static content anyway.

Re: You can serve static data over HTTP

#53
post #13

And serving it over plain http is how you can get Man-In-the-Middled!

To be fair, you can get MITMd with HTTPS too. How do you think Cloudflare inspects web traffic?

not sure that MITM definition applies here: cloudflare is serving the data, they're not in the middle, they're either alice or bob

Re: You can serve static data over HTTP

#54

Not from a modern developer. You need to jump down the rabbit hole of the history of solid and proven solutions. Indeed. I've noticed an increasing number of people who call themselves "developers" and appear to create software, but all they can do is follow step-by-step tutorials to glue together some massively bloated thing that they have absolutely no understanding of, much less the skills to debug it when somethi…

You might not want them in your team maybe, but isn’t it really cool we reached a state where you can actually do this? Democratization of software engineering is a great good!

Democratization of software engineering means giving everyone the opportunity to learn. Not handing them a black box with a few instructions then sending them off to plow head first into a brick wall of insurmountable knowledge gaps so they give up.

Re: You can serve static data over HTTP

#55

Earlier quoted context omitted.

To be fair, you can get MITMd with HTTPS too. How do you think Cloudflare inspects web traffic?

not sure that MITM definition applies here: cloudflare is serving the data, they're not in the middle, they're either alice or bob

They do host some data, but they delegate a lot of connections as well. One of their biggest products is bot mitigation, where they'll inspect incoming connections/traffic and pass them through if they don't seem to be bots.

This is essentially MITM-as-a-service.

Re: You can serve static data over HTTP

#56
post #34

> You can serve static data over HTTP Yes. Just like you can put letters together and form words. It's kind of what it was designed to do.

You'd be surprised talking to the younger crowd.

Some time ago, a website was posted here (forgot the topic) which consisted of .md files, and a JavaScript library which would then, on the client, render the markdown on the fly.

Why on earth the markdown was not pushed through a renderer so that then the server could serve static HTML is probably a question that only occurs to old timers like us.

Re: You can serve static data over HTTP

#57
I hope the author means HTTPS, not HTTP - otherwise, I don't think this is a good idea.

Anyway, as everything in software development: it all depends - serving a simple JSON over an existing "full blown web application back-end" is usually more convenient and less confusing for developers than configuring hosting for static content. Although, if you JUST want to serve a JSON then, yeah, you can add it as a static resource.

Re: You can serve static data over HTTP

#58

Not from a modern developer. You need to jump down the rabbit hole of the history of solid and proven solutions. Indeed. I've noticed an increasing number of people who call themselves "developers" and appear to create software, but all they can do is follow step-by-step tutorials to glue together some massively bloated thing that they have absolutely no understanding of, much less the skills to debug it when somethi…

> glue together some massively bloated thing that they have absolutely no understanding of

Relevant: https://xkcd.com/1988/

Re: You can serve static data over HTTP

#59
post #42

Not from a modern developer. You need to jump down the rabbit hole of the history of solid and proven solutions. Indeed. I've noticed an increasing number of people who call themselves "developers" and appear to create software, but all they can do is follow step-by-step tutorials to glue together some massively bloated thing that they have absolutely no understanding of, much less the skills to debug it when somethi…

> glue together some massively bloated thing that they have absolutely no understanding of Welcome to the world of npm and supply-chain hell

Java and Golang aren't any different.

Re: You can serve static data over HTTP

#60
> It's not illegal to use static files and it does work.

No, it doesn't. Maybe for your personal homepage with three hits per month, but even on a low traffic server, static files gave me headaches.

1) When two visitors write to the file at the same time, the data of one of the visitors will be gone. This can be solved by using lock files. This is a topic on its own (what happens when two processes both create a lockfile at the same time?). Also, when there are a lot of writes happening, multiple processes will wait for the lockfiles, creating load on the server and wait times for the visitor.

2) When a file is read during while another process is doing a write, the file is only read partially. There are workarounds for this as well, you can first write to another file and when done, move this other file to the correct file.

As the number of visitor increases or the file size increases, problems will get harder.

Nowadays it's not hard to add a database. Whether it's on your server or in the cloud. It's performant, it works and it will grow with increasing demand.

It's probably easier to set up than a file based solution.

Sometimes what seems to be simple isn't really.

Post reply on HN