5 ms·
Another optimization in the same vein: make sure the first KB contains the <meta charset> element, to avoid false-starts in the HTML parser. In fact, it's actu
by hoten 4y ago
Another optimization in the same vein: make sure the first KB contains the <meta charset> element, to avoid false-starts in the HTML parser. In fact, it's actually specified as an _error_ in the spec to have it come after 1KB!
It's mentioned in passing on the Lighthouse docs for the charset audit[1], but here's a great breakdown by hsivonen[2].
Of course, in the headers is even better. Point is, try not to have too much cruft before the charset.
[1] https://web.dev/charset/ https://web.dev/charset/
[2] https://github.com/GoogleChrome/lighthouse/issues/10023#issuecomment-575129051 https://github.com/GoogleChrome/lighthouse/issues/10023#issu...
- nousermane 4y ago> Of course, in the headers is even better. Yes, much better. And given prevalence of UTF-8 this days, why not just hard-code your webserver to add such header everywhere: - Apache <VirtualHost ...> <Directory ...> AddDefaultCharset utf-8 ... - nginx http { charset utf-8; ... - Caddy: done already with no explicit config required, yay!
- tracker1 4y agoHave to say, I absolutely love Caddy as a general webserver and reverse-proxy. Lightweight, easy to configure, relatively flexible, sane defaults.
- rockostrich 4y agoI was skeptical coming from running my home server with nginx as a reverse proxy for a bunch of services, but caddy is a joy to use.
- soheil 4y ago> easy to configure, relatively flexible, sane defaults Compared to what? You think nginx is not easy to configure or has insane defaults somehow? Really baffled why people come out of the wood work to pile on beautifully architectured designs in favor of some random project they happen to like or just because it's written in a language they have a special affinity for like Go or something.
- kdmccormick 4y agoIn terms of saner defaults: The charset="utf-8" default described above is one example. TLS enabled by default is another. Also, you could asked all your questions without being incendiary and making assumptions about why people like Caddy. Nobody mentioned Go except you.
- soheil 4y ago
- shepherdjerred 4y agoHave you used Caddy for reverse proxying compared to nginx? It's infinitely easier. Two lines per site, https built in, dynamic upstreams are handled by default, HTTP 2 enabled (maybe nginx does HTTP 2 by default,; not sure).
- soheil 4y agoEasier in what sense? If you find the most esoteric feature and then claim it's easier for that purpose, that doesn't count! If you're going to claim it's easier to configure than nginx you have to make a fair comparison by comparing not the features that you care about, but instead the features that define the system as a whole.
- lambda_dn 4y agoThe Caddy website has it written "Caddy is a powerful, extensible platform to serve your sites, services, and apps, written in Go" That could confuse developers thinking they can only develop apps in Go with caddy?
- joaonmatos 4y agoEnglish is my second language, and the comma separating that particle from the rest of the sentence makes it pretty explicit even for me that it is talking about the platform, at the same semantic level as “powerful”, “extensive” and “to serve your sites […]”.
- Noumenon72 4y agoYes, but the incongruousness of telling me what language something is written in in its sales one-liner makes me think it must be pitching itself as "especially for apps written in Go", because who thinks I am going to pick a tool because it is written in Go? "Try ElasticSearch, written in Java!"
- im3w1l 4y agoI avoid new server software written in languages with too many footguns such as c or php. Nginx gets a grandfather exception, but I'm not sure I would have extended one to caddy.
- cercatrova 4y agoI would, Go and Rust are fast compiled languages and I would absolutely pick something written in those over alternatives.
- Abishek_Muthian 4y agoAnd bit ironic considering the portability of Go enables one to develop a web service with built-in packages without requiring an explicit web server.