Accidentally wrapping header statements in Caddyfile

I just wanted to share a strange problem I had that did only manifest using Safari using HTTP/3, and did not happen in Chrome using HTTP/3. I have the following snippet in most of my sites:

(defaulthdr) {
        header {
                Strict-Transport-Security "max-age=15552000; includeSubDomains;

As anyone can see, the line is pretty long. My vim did wrap the line after the second semicolon, and that caused Safari to throw strange header errors and not displaying anything from that site. Caddy did not mention a problem loading the Caddyfile, so I did not notice that for some time.

So what you are suggesting is some sort of warning or hard-error, whenever someone has a line break as header value, or what? :thinking:

I would guess a warning like the formatted Caddyfile warning would be helpful.

Your editor should definitely not be inserting line breaks in random places. That sounds like a bug in the editor.

You might be right, that was part of my somewhat arcane .vimrc. There should have been an exception for Caddyfiles, which I added now.

1 Like

I use set formatoptions-=t in my .vimrc to stop vim from inserting an actual line break when it visually wraps lines, universally. I find it particularly egregious for an editor to add a line break against my wishes rather than just indicating my preferred column width.


This topic was automatically closed after 30 days. New replies are no longer allowed.