Regular expression - Nginx $upstream_http_content_type regular expression problem
世界只因有你
世界只因有你 2017-05-16 17:24:03
0
1
886

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?

世界只因有你
世界只因有你

reply all(1)
左手右手慢动作

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)

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template