I understand that the “charset utf-8” directive in an http or server block of a configuration file should make nginx include “Content-Type: text/html; charset=utf-8” in the headers of a response, instead of only “Content-Type: text/html”.
However, I have added that directive to both the http block and the applicable server block, and the “Content-Type” directive has remained unchanged.
Precautions taken include: 1. Reloading or restarting nginx after each config change. 2. Including a “charset_types text/html text/plain;” directive before. 3. Making an unrelated config change and verifying that it DOES have its expected effect.
I have looked at the related discussions here and at the nginx documentation and not found any explanation.