Live data from Hacker News

Show HN: Hosting my website using my C web server

github.com

141–150 of 160 posts

Re: Show HN: Hosting my website using my C web server

#142
post #130
post #70

> No reverse proxies required! This is one that has always baffled me. If there's no specific reason that a reverse proxy is helpful, I will often hang an app with an embedded Jetty out on the internet without one. This has never lead to any problems. Infra or security people will see this and ask why I don't have an nginx instance in front of it. When I ask why I need one, the answers are all hand-wavy security or p…

> slow loris, Really? I am curious. You are not talking of monkeys?

It's a pretty clever attack: https://en.wikipedia.org/wiki/Slowloris_(computer_security)

Re: Show HN: Hosting my website using my C web server

#143
post #128

Earlier quoted context omitted.

What are you on about? C is more useful day-to-day than the vast majority of languages. Learning it is hardly a waste of time.

C is one of the worst designed programming languages still in use. It's a ridiculous, cruel joke on anyone looking to learn unless your actual goal is to learn what a programming language designed 70s computers looks like.

[flagged]

Re: Show HN: Hosting my website using my C web server

#144
post #12

Earlier quoted context omitted.

Not the only time it’s been brought up in this thread: https://news.ycombinator.com/item?id=41643198 I’m waiting for someone to chime in and explain why that would be a bad idea cause I can’t think of it from a security perspective.

Once at a certain level of complexity, e.g. having several hundred/thousand resources, then you start automating your hardcoded paths, and then you still can get bitten. vs just putting things in a subfolder of your repo or whatever and having the default handling not accept `..` path components

But OP isn't reaching that certain level of complexity, doesn't have thousands of resources, he is hosting his own website.

Re: Show HN: Hosting my website using my C web server

#145
post #12

Earlier quoted context omitted.

Not the only time it’s been brought up in this thread: https://news.ycombinator.com/item?id=41643198 I’m waiting for someone to chime in and explain why that would be a bad idea cause I can’t think of it from a security perspective.

From a security perspective a lot of changes to this world would be an upgrade. However implementing security features is always a trade off, and sometimes good security is just not worth the loss of other things.

My favourite phenomenon is when (computer) security gets in the way of (actual) security.

For example, you implement a super secure solution and no one hacks your website, but you end up being very unproductive and can't find a job. You lost food security.

In covid, bank systems in my country were so hard to use, there were like 6 passwords to login. Not only was usability compromised in the sense of security, but people, especially old people, started lining up in banks, compromising health security.

To say nothing of the scenarios were users just bypass obnoxious exaggerated security systems, like leaving a post-it note with a password on their screens.

Re: Show HN: Hosting my website using my C web server

#146

How about embedding the contents of the HTML files so that no access to the filesystem is required? That would make it not only faster but also safer.

does that mean recompile every time them HTML is changed? No thanks :)

A nice intermediate I use is baking the paths into the source code, so that I only recompile when I add files, but I can hot-swap contents without even restarting the server.

Although if you start caching contents in memory (which is faster) you would have to at least kill the server and restart it. Or signal a reload.

Re: Show HN: Hosting my website using my C web server

#147
post #70

> No reverse proxies required! This is one that has always baffled me. If there's no specific reason that a reverse proxy is helpful, I will often hang an app with an embedded Jetty out on the internet without one. This has never lead to any problems. Infra or security people will see this and ask why I don't have an nginx instance in front of it. When I ask why I need one, the answers are all hand-wavy security or p…

For me, Reverse proxy helps me keep my origin server only for 1 purpose: Serve the Application. Everything else, I can handle with Reverse Proxy including TLS Termination, load balancing, URL rewrites, Security (WAF etc) if needed. Separation of duties for me. Overall, the benefit is that you can keep your origin server protected and only serve relevant traffic. Also, lets say you offer custom domain to your own cust…

TLS should be done with proxies, yes. The Stunnel approach is Gospel.

Similarly if you start load balancing, you can put some server in the middle yes. But the ideal solution is at the DNS level I think, unless there's some serious compute going on (which a website loading a page from disk is not).

URL rewrites should not be a thing unless you have a clusterfuck, and Security is best accomplished in my experience by removing, rather than by adding.

Re: Show HN: Hosting my website using my C web server

#148

Earlier quoted context omitted.

For me, Reverse proxy helps me keep my origin server only for 1 purpose: Serve the Application. Everything else, I can handle with Reverse Proxy including TLS Termination, load balancing, URL rewrites, Security (WAF etc) if needed. Separation of duties for me. Overall, the benefit is that you can keep your origin server protected and only serve relevant traffic. Also, lets say you offer custom domain to your own cust…

TLS should be done with proxies, yes. The Stunnel approach is Gospel. Similarly if you start load balancing, you can put some server in the middle yes. But the ideal solution is at the DNS level I think, unless there's some serious compute going on (which a website loading a page from disk is not). URL rewrites should not be a thing unless you have a clusterfuck, and Security is best accomplished in my experience by…

I've worked at a place where even internal traffic that crosses machines needs to be encrypted.

So Ingress -TLS-> Container (pod).

We implemented LinkerD for this, which runs as a sidecar in the pod. Since the sidecar and the main container communicate on the same machine, this is OK.

Re: Show HN: Hosting my website using my C web server

#149
post #134
post #86

Earlier quoted context omitted.

this looks much more practical than my own small and lightweight http/1.0 webserver, but i'm guessing that rws is not nearly as small and lightweight: http://canonical.org/~kragen/sw/dev3/server.s http://canonical.org/~kragen/sw/dev3/httpdito-readme the really surprising thing about that was that when your memory map only has five 4k pages in it, linux gets really fast at forking

httpdito looks incredible

glad you like it!

Re: Show HN: Hosting my website using my C web server

#150

Earlier quoted context omitted.

It’s kind of sad how C has gotten the reputation as this dangerous and scary dark art that only wizards can successfully wield. C was my first love, it’s what we used throughout university, it’s what our operating systems and basic tools are all written in... If you go to your favorite language and step down into the actual implementation of, for example, your network calls, you’re eventually going to get to poll() a…

But if the dy/dx gradient is that experts can develop faster in safe languages, and novices make fewer mistakes in safe languages, then C isn't useful day-to-day. It occupies an ever-shrinking ecological niche on the Pareto frontier.

Some of the worst software I've ever used, and also some of the worst software I've ever seen developed, was done by novices in safe languages. You can't escape how the computer works, you can only plug your ears and yell "LALALALALA!" really loud. But that doesn't change reality. If you aren't a good developer, you won't make good software, in any language. That's not the language's fault. If you don't understand pointers, that's on you. Computers use indirection; it's a fact of the craft. It doesn't matter if your fancy runtime hides them from you, they're still in there, and you should know how they work; not only because they're simply important, but because they'll make it easier for you to reason about things when something goes wrong. Otherwise, you'll sit there helpless and come running to someone like me with screenshots of stack traces that tell you exactly what's wrong. (Yes, this happens to me all the time.)
Post reply on HN