I use nginx's $upstream_http_content_type to determine whether the type is an image. The code is as follows:
add_header X-Content-Type $upstream_http_content_type;
if ($upstream_http_content_type ~* ^image/(jpg|jpeg|pjpeg|png|x-png|gif|bmp|x-icon|webp|svg\+xml)) {
return 301;
}
But the result is that X-Content-Type is present, but there is no 301 jump?
Theoretically it should be Jiang Zi:
How to solve it?
I didn’t look carefully. If it’s really a regular issue, it’s because the slash after your image is not escaped
^image/(jpg|jpeg|pjpeg|png|x-png|gif|bmp|x-icon|webp|svg+xml)