4 ms·
I'd add another, something like "Be Aware of the Ramifications of Partial HTTP/S Implementations". Because it's so easy to expose http/https in golang, I see a
by tyingq 10y ago
I'd add another, something like "Be Aware of the Ramifications of Partial HTTP/S Implementations".
Because it's so easy to expose http/https in golang, I see a fair amount of code that takes the easy path of handling GETS and not doing much else. No support for HEAD, or compression, proper mime types in Content-type, or lacking Cache-Control headers, Etags, 304 responses, etc. Go can do all these, of course, but I see them missing often.
I've seen, for example, blogs, that (probably not on purpose) defeat browser caching. Not great for performance, or your egress bill.
- jdc0589 10y agopretty common problem with any of the newer languages or environments that have great native stdlib support for http/s servers. A bare bones http/s server is so easy to spin up with nothing other than the stdlib, people who are used to using full stack frameworks forget about all the stuff it did for them behind the scenes.
- niftich 10y agoI realize that much of the Go community is hesitant about the sort of third-party code that intentionally constraints the problem-space by restricting choice and then calls your code at a few well-defined points; preferring to call out to libraries instead (vs. the other way around); but what solutions, if any, are widely utilized to avoid the above situation?
- tyingq 10y agoGuessing most people that care about this would have some sort of "minimum http header/feature" test that runs each build.
- omginternets 10y agoI quite like http://echo.labstack.com http://echo.labstack.com I quite like it because you can access the net/http constructs (ResponseWriter, Request, etc) if you really need them, but in most cases it removes a lot of boilerplate.
- xienze 10y agoOne thing about Go developers that sort of baffles me is their desire to handle HTTPS. Yes, Go makes it easy to do so, but really you should be sticking your Go app behind Apache, NGiNX, etc. instead of putting it directly on the Internet for reasons you've listed and more.
- jerf 10y agoPutting your Go webserver behind nginx will fix, by my count, only one of those, compression. Maybe 10% of a point for faking up HEAD support, but nginx converting a GET into a HEAD by simply dropping the body isn't very compelling. Putting your webserver behind nginx just to do it isn't very compelling. To get a win you really need to be doing something in nginx beyond merely just proxying. That's not really a Go-specific complaint, that's a complaint about a loooot of implementations of web stuff. Edit: Compression is less important than it sounds, too; for security reasons, you shouldn't compress dynamic content going over HTTPS, so nginx doing the compression only helps for HTTP, and it's only a handful of lines of code to implement it in your Go layer too so it's not a huge win. If nginx did fix a lot of those problems without having to think about it, it would be helpful, but it doesn't.
- sofaofthedamned 10y agoQuite right. Compression over TLS, although useful, is frowned upon for the reasons you state. I'm normally the sort of guy who puts everything behind HAProxy, I may still do that for convenience (certs in the same place etc) but imagine moving to a point where I put the Go programs behind, but in TCP mode.
- deleted 10y ago[deleted]
- zacmps 10y agoWhy do you think go would be run behind a reverse proxy for TLS?
- xienze 10y ago