Welcome! Log In Create A New Profile

Advanced

Re: Замена content-type image/webp в location

Илья Шипицин
November 06, 2019 04:54PM
default_type text/plain;

вместо

add_header Content-Type text/plain;


чт, 7 нояб. 2019 г. в 02:44, commeta <nginx-forum@forum.nginx.org>:

> location / {
> location ~ [^/]\.ph(p\d*|tml)$ {
> try_files /does_not_exists @apacheback;
> }
> location ~*
>
> ^.+\.(gif|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf|woff|woff2|ico|ttf)$
> {
> try_files $uri $uri/ @fallback;
> expires 365d;
> }
> location ~* ^.+\.(jpg|jpeg|png)$ {
> set $ax 0;
> if ( $http_accept ~* "webp" ) {
> set $ax 1;
> }
> if ( -e $root_path/webp$uri ){
> set $ax "${ax}1";
> }
> if ( $ax = "11" ) {
> rewrite ^ /webp$uri break;
> add_header Vary Accept;
> add_header Content-Type image/webp;
> }
> expires 365d;
> try_files $uri $uri/ @fallback;
> }
> location / {
> try_files /does_not_exists @fallback;
> }
> }
> nginx/1.16.1
>
> На сайте есть отдельный подкаталог с копиями всех изображений в формате
> webp. Nginx на лету если есть поддержка браузером отдает webp вместо
> jpeg\png. Но появляется 2 заголовка:
> content-type: image/png
> content-type: image/webp
> Подскажите как в этом случае убрать первый заголовок image/png
>
> Posted at Nginx Forum:
> https://forum.nginx.org/read.php?21,286117,286117#msg-286117
>
> _______________________________________________
> nginx-ru mailing list
> nginx-ru@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-ru
_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

Замена content-type image/webp в location

commeta November 06, 2019 04:44PM

Re: Замена content-type image/webp в location

Илья Шипицин November 06, 2019 04:54PM

Re: Замена content-type image/webp в location

commeta November 06, 2019 06:19PM

Re: Замена content-type image/webp в location

NickLavlinsky November 07, 2019 03:29AM

Re: Замена content-type image/webp в location

commeta November 07, 2019 07:53AM

Re: Замена content-type image/webp в location

damir bikmuhametov November 07, 2019 08:30AM

Re: Замена content-type image/webp в location

Илья Шипицин November 07, 2019 08:30AM

Re: Замена content-type image/webp в location

commeta November 07, 2019 08:21PM

Re: Замена content-type image/webp в location

commeta November 07, 2019 10:30PM

Re: Замена content-type image/webp в location

damir bikmuhametov November 07, 2019 10:26PM

Re: Замена content-type image/webp в location

vitcool November 07, 2019 08:24AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 100
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready